gpt4 book ai didi

php - 插入不会将 itemID 插入数据库表

转载 作者:行者123 更新时间:2023-11-30 00:14:50 24 4
gpt4 key购买 nike

好的,所以当有人从我的网站购买商品时,需要将该商品 ID 插入数据库,但由于某种原因没有插入。

$mysql_host = 'localhost'; //Leave at localhost  
$mysql_user = ''; //DB User
$mysql_pass = ''; //DB Pass
$mysql_db = ''; //DB Name
$file = 'paypal.log'; //Paypal Log Name will be placed in the same location as your ipn.php file
$payer_email = $_REQUEST['payer_email'];
$ip = $_SERVER['REMOTE_ADDR'];

$time = date("F j, Y, g:i a");
$paylist = array("5.00" => 15017, "0.01" => 18830, "10.00" => 13840, "10.01" => 13842, "9.99" => 13729, "15.00" => 19111, "60.00" => 1046, "40.00" => 1050, "14.99" => 6199);


// connect db

$db = mysql_connect($mysql_host, $mysql_user, $mysql_pass) or die(mysql_error());

$custom = stripslashes(ucwords(strtolower(trim($_REQUEST['custom']))));
$receiver_email = $_REQUEST['receiver_email'];
$payment_status = $_REQUEST['payment_status'];
$mc_gross = $_REQUEST['mc_gross'];
mysql_select_db($mysql_db, $db);
if ($_REQUEST['debug']){
print $payment_status . '\n';
print (isset($paylist[$mc_gross])) ? 1 : 0 . '\n';
print $receiver_email . '\n';
print $custom . '\n';
}
if ($payment_status == "Completed" && $receiver_email == "justincopp77@yahoo.com" && isset($paylist[$mc_gross])) {


$query = "INSERT `status` SET `item` = '$itemid' ,`username` = '$custom'";

$result2 = mysql_query($query) or die(mysql_error());

$prem = mysql_fetch_array($result);
$somecode = "'$time' '$custom' '$payer_email' '$mc_gross' '$ip'\r\n";

// figure out how much to give
$give = $paylist[$mc_gross];
$itemid = $prem['item'] + $give;
// $points = mysql_query($prem)
$qry2 = "SELECT `item` FROM `status` WHERE `username` = '$custom'";
// Log Paypal Transaction
$hak = fopen($file, "a");
fwrite($hak, $somecode);
fclose($hak);

$result2 = mysql_query($qry2) or die(mysql_error());
}
?>

enter image description here

你可以看到它没有将项目ID放入有谁知道为什么它不会将项目 ID 插入数据库?我需要改变什么来修复它

提前致谢

最佳答案

你的sql语法错误

$query = "INSERT INTO `status` (item, username) VALUES ('$itemid' ,'$custom')";  

关于php - 插入不会将 itemID 插入数据库表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23744855/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com