Issues With Double Insert MYSQLI
Are you allowed to do something like this with mysqli? I'm getting nothing
going in.
// Place the transaction into the database
$sql = "INSERT INTO transactions (product_id_array, email, first_name,
last_name, payment_date, mc_gross, payment_currency, txn_id,
receiver_email, payment_type, payment_status, txn_type, payer_status,
address_street, address_city, address_state, address_zip,
address_country, address_status, notify_version, verify_sign, payer_id,
mc_currency, mc_fee, ip, username)
VALUES('$custom','$payer_email','$first_name','$last_name','$payment_date','$mc_gross','$payment_currency','$txn_id','$receiver_email','$payment_type','$payment_status','$txn_type','$payer_status','$address_street','$address_city','$address_state','$address_zip','$address_country','$address_status','$notify_version','$verify_sign','$payer_id','$mc_currency','$mc_fee','$ip','$user_name')";
$uid = mysqli_insert_id($db_conx);
$sql .= "INSERT INTO courseprogress (id, product_id_array,
email, username) VALUES
('$uid','$custom','$payer_email','$username')";
$query = mysqli_query($db_conx, $sql);
//
I've tried to use two separate statements like this
$sql = "INSERT INTO transactions (product_id_array, email, first_name,
last_name, payment_date, mc_gross, payment_currency, txn_id,
receiver_email, payment_type, payment_status, txn_type, payer_status,
address_street, address_city, address_state, address_zip, address_country,
address_status, notify_version, verify_sign, payer_id, mc_currency,
mc_fee, ip, username)
VALUES('$custom','$payer_email','$first_name','$last_name','$payment_date','$mc_gross','$payment_currency','$txn_id','$receiver_email','$payment_type','$payment_status','$txn_type','$payer_status','$address_street','$address_city','$address_state','$address_zip','$address_country','$address_status','$notify_version','$verify_sign','$payer_id','$mc_currency','$mc_fee','$ip','$user_name')";
$query = mysqli_query($db_conx, $sql);
//added as addition for newsletter signup below
$uid = mysqli_insert_id($db_conx);
$sqlemail = "INSERT INTO courseprogress (id, product_id_array,
email,username) VALUES
('$uid','$custom','$payer_email','$username')";
$query = mysqli_query($db_conx, $sqlemail);
//
I've only been able to get the first to go through though...Any suggestions?
No comments:
Post a Comment