Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/249.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Paypal IPN脚本/MySql插入查询问题_Php_Mysql_Sql_Paypal - Fatal编程技术网

Php Paypal IPN脚本/MySql插入查询问题

Php Paypal IPN脚本/MySql插入查询问题,php,mysql,sql,paypal,Php,Mysql,Sql,Paypal,我的IPN脚本有问题。 它的罚款核实付款等,但我试图让它输入到一个数据库的数据。 之前的用户电子邮件和密码输入可以正常工作,但第二个不能 $item_name = $_POST['item_name']; $item_number = $_POST['item_number']; $payment_status = $_POST['payment_status']; $payment_amount = $_POST['mc_gross']; $payment_currency = $_POST[

我的IPN脚本有问题。 它的罚款核实付款等,但我试图让它输入到一个数据库的数据。 之前的用户电子邮件和密码输入可以正常工作,但第二个不能

$item_name = $_POST['item_name'];
$item_number = $_POST['item_number'];
$payment_status = $_POST['payment_status'];
$payment_amount = $_POST['mc_gross'];
$payment_currency = $_POST['mc_currency'];
$txn_id = $_POST['txn_id'];
$receiver_email = $_POST['receiver_email'];
$payer_email = $_POST['payer_email'];

$email = $_POST['item_name'];
$password = mt_rand(1000, 9999);
$Random = print_r($_POST);


mysql_query("INSERT INTO users (email, password) VALUES('". mysql_escape_string($email)     ."', '".md5($password)."') ") or die(mysql_error()); 

mysql_query("INSERT INTO LNCH_Sales SET
                                                            item_name = '%s',
                                                            item_number = '%s',
                                                            payment_status = '%s',
                                                            payment_amount = '%s',
                                                            payment_currency = '%s',
                                                                txn_id = '%s',
                                                            receiver_email = '%s',
                                                            payer_email = '%s'",
                                                            mysql_real_escape_string($item['name']),
                                                            mysql_real_escape_string($item['number']),
                                                            mysql_real_escape_string($payment['status']),
                                                            mysql_real_escape_string($payment['amount']),
                                                            mysql_real_escape_string($payment['currency']),       
                                                            mysql_real_escape_string($txn['id']),
                                                            mysql_real_escape_string($receiver['email']),
                                                            mysql_real_escape_string($payer['email'])

                                                                      );

你知道这里怎么了吗?

你的语法错了-而不是

INSERT INTO LNCH_SALES SET
(看起来像是插入和更新的混合体),您需要

INSERT INTO LNCH_SALES(<column_list>) VALUES (...
插入LNCH_SALES()值(。。。

您的语法错误-而不是

INSERT INTO LNCH_SALES SET
(看起来像是插入和更新的混合体),您需要

INSERT INTO LNCH_SALES(<column_list>) VALUES (...
插入LNCH_SALES()值(。。。

正如@FrankSchmitt所说,您可能缺少列列表

可以跳过列列表的唯一方法是插入列数=表列数,即:

jcho360> create table test (id int,name varchar(20));
Query OK, 0 rows affected (0.05 sec)

jcho360> insert into test values (1,'Jcho360');
Query OK, 1 row affected (0.00 sec)

jcho360> insert into test values (1);
ERROR 1136 (21S01): Column count doesn't match value count at row 1

jcho360> insert into test(id) values (1);
Query OK, 1 row affected (0.01 sec)

正如您所见,只有当我准备填写“插入”中的所有列时,您才可以跳过列列表。

正如@FrankSchmitt所说,您可能缺少列列表

可以跳过列列表的唯一方法是插入列数=表列数,即:

jcho360> create table test (id int,name varchar(20));
Query OK, 0 rows affected (0.05 sec)

jcho360> insert into test values (1,'Jcho360');
Query OK, 1 row affected (0.00 sec)

jcho360> insert into test values (1);
ERROR 1136 (21S01): Column count doesn't match value count at row 1

jcho360> insert into test(id) values (1);
Query OK, 1 row affected (0.01 sec)
正如您所看到的,只有当我准备填写“插入”中的所有列时,您才能跳过列列表