sore bli, saya butuh bantuannya bli untuk query yang saya buat ini.
ada 4 query tetapi query yang berhasil INSERT ke database hanya query pertama saja. sedangkan ketika saya "echo" hasil dari query kedua dan saya masukkan ke phpmyadminnya query tersebut berhasil ke INSERT bli.
berikut querynya bli:
<?php
if (isset($_POST['productName']))
{
$txtMemberId = $_POST['MemberId'];
$txtproductName = $_POST['productName'];
$txtCategory = $_POST['Category'];
$txtproductKeyword = $_POST['productKeyword'];
$txtsummary = $_POST['summary'];
$txtBrandName = $_POST['BrandName'];
$txtModel = $_POST['Model'];
$txtpackagingDesc = $_POST['packagingDesc'];
$txtDetailDesc = $_POST['DetailDesc'];
$images = "./img/auction/kucing2.jpg";
$txtRFQType = $_POST['RFQType'];
$txtcurrencies_id = $_POST['currencies_id'];
$txtrad = $_POST['rad'];
$txtprice_mask = $_POST['price_mask'];
$txtStartDate = $_POST['StartDate'];
$txtStartTime = $_POST['StartTime'];
$txtCloseDate = $_POST['CloseDate'];
$txtClosetTime = $_POST['ClosetTime'];
$txtTimeEx = $_POST['TimeEx'];
$txtDeliDate = $_POST['DeliDate'];
$txtpayment_tems = $_POST['payment_tems'];
$txtDTDT = $_POST['DTDT'];
$txtReceive = $_POST['Receive'];
$txtDataSheet = "./img/auction/kucing2.jpg";
// // koneksi ke mysql server hosting
mysql_connect('localhost', 'root', '');
mysql_select_db('db_blog');
$q1 = "INSERT INTO product(member_id, product_name, category_id, product_Keyword, product_des, product_poto, product_brand, product_model, product_packaging, product_detdes, approv, c_date)
VALUES ('$txtMemberId','$txtproductName','$txtCategory','$txtproductKeyword','$txt summary','$images','$txtBrandName','$txtModel','$txtpackagingDesc','$txtDet ailDesc','0',now())";
echo $q1 ;
mysql_query($q1);
$productId = mysql_insert_id();
$q2 = "INSERT INTO products(product_id, member_id, rfq_type, currency, R_TypeStart, price_marking, str_date, str_time, ex_date, ex_time, R_AutoEx, delivery_date, pay_terms, delivery_to, ket, data_sheet)
VALUES ('$productId','$txtMemberId','$txtRFQType','$txtcurrencies_id','$txtrad','$ txtprice_mask','$txtStartDate','$txtStartTime','$txtCloseDate','$txtClosetT ime','$txtTimeEx','$txtDeliDate','$txtpayment_tems','$txtDTDT','$txtReceive ','$txtDataSheet')";
echo '<br/>';
echo $q2;
if($txtTimeEx == '2'){
$q4 = "INSERT INTO timeex(product_id, ex_margin, et_day, ex_hours, ex_minute, ex_freq)
VALUES ('$productId','4','1','3','30','5')";
}
echo '<br/>';
echo $q4;
if ($txtrad == '1'){
$q3 = "INSERT INTO pricebasic(product_id, price) VALUES ('$productId','20000')";
}else{
$q3 ="INSERT INTO pricedua(product_id, name, qty, price, total) VALUES ('$productId','test wawan','100','10000','1000000')";
}
echo '<br/>';
echo $q3;
$hasil = mysql_query($q1 and $q2 and $q3);
if($hasil) {
echo "[removed]alert('Permintaan Anda berhasil disimpan.');[removed]";
} else {
echo "[removed]alert('Permintaan Anda tidak berhasil disimpan.');[removed]";
}
}
else
{
unset($_POST['email']);
}
?>
sekali lagi mohon bantuannya bli.
Terima kasih