0

你可以用mysqli做这样的事情吗?我什么都没有进去。

// 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);
   //

我尝试使用这样的两个单独的语句

$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);
   //

我只能在较低的尝试中获得第一个通过...有什么建议吗?

4

1 回答 1

0

你有 $db_conx 数据在错误的地方,它需要在同一个语句中。你升级了 sql 吗?...我做到了,我不得不重新计算我创建的整个项目。创建一个保存数据或全局数据的函数,并在每次使用语句或函数时重新声明 $db_conx。

于 2014-10-06T09:32:48.050 回答