Wednesday, June 11, 2008

PHP-script insert

<?
$conn = mysql_connect("localhost","root","");
mysql_select_db("basdat",$conn);
$tmp_id_pesanan = $HTTP_POST_VARS['id_pesanan'];
$tmp_id_pemesan = $HTTP_POST_VARS['id_pemesan'];
$tmp_id_pegawai = $HTTP_GET_VARS['id_pegawai'];
$tmp_tgl_pesan = $HTTP_POST_VARS['tgl_pesan'];
$tmp_lama = $HTTP_POST_VARS['lama'];
$tmp_id_kamar = $HTTP_POST_VARS['id_kamar'];
$tmp_id_meeting = $HTTP_POST_VARS['id_meeting'];

if ($tmp_id_meeting!="")
{
$sql3 = mysql_query("update meeting set status = 'isi' where id_meeting = '$tmp_id_meeting'");
$a= mysql_query("select harga from meeting where id_meeting = '$tmp_id_meeting'");

$sql = "insert into pesanan (id_pesanan, id_pemesan, id_pegawai, tgl_pesan, lama, id_kamar, id_meeting, total_harga) values('$tmp_id_pesanan', '$tmp_id_pemesan','$tmp_id_pegawai', '$tmp_tgl_pesan','$tmp_lama','$tmp_id_kamar','$tmp_id_meeting','$a')";
mysql_query($sql);
}

header("location:insert.php");
mysql_close($conn);
?>

No comments:

Post a Comment