Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/62.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 MYSQL_Php_Mysql_Database_Forms - Fatal编程技术网

将表单中的数据插入数据库PHP MYSQL

将表单中的数据插入数据库PHP MYSQL,php,mysql,database,forms,Php,Mysql,Database,Forms,我正试着将表格中的数据发送到我的数据库中,但我似乎没有工作。表字段是正确的。有人能看到出了什么问题吗 表格: 如果id是auto increment,则将其从values()中的addNULL查询中删除,同时引号也未正确管理 $strsq0 = "INSERT INTO idea (`name`, `originator`, `alternative_contact`, `problem`, `description`, `po`, `arch_client`, `urgency`, `tech

我正试着将表格中的数据发送到我的数据库中,但我似乎没有工作。表字段是正确的。有人能看到出了什么问题吗

表格:


如果
id
auto increment
,则将其从
values()
中的add
NULL
查询中删除,同时引号也未正确管理

$strsq0 = "INSERT INTO idea (`name`, `originator`, `alternative_contact`, `problem`, `description`, `po`, `arch_client`, `urgency`, `technology`, `sprints`, `progress`, `status`) VALUES ('$name','$originator','$altcontact ','$problem', '$description', '$po','$archclient', '$urgency', '$technology', '$sprints','$progress', '$status')"; //query to insert new idea
进行更多调试

echo "INSERT INTO idea (`name`, `originator`, `alternative_contact`, `problem`, `description`, `po`, `arch_client`, `urgency`, `technology`, `sprints`, `progress`, `status`) VALUES ('$name','$originator','$altcontact ','$problem', '$description', '$po','$archclient', '$urgency', '$technology', '$sprints','$progress', '$status')";
exit;
$strsq0 = "INSERT INTO idea (`name`, `originator`, `alternative_contact`, `problem`, `description`, `po`, `arch_client`, `urgency`, `technology`, `sprints`, `progress`, `status`) VALUES ('$name','$originator','$altcontact ','$problem', '$description', '$po','$archclient', '$urgency', '$technology', '$sprints','$progress', '$status')"; //query to insert new idea

然后复制此打印的查询并在
phpMyadmin
中运行,检查在运行打印的查询后是否有任何错误。

如果
id
自动递增的
,则将其从
值()
中的add
NULL
查询中删除,同时引号也未正确管理

$strsq0 = "INSERT INTO idea (`name`, `originator`, `alternative_contact`, `problem`, `description`, `po`, `arch_client`, `urgency`, `technology`, `sprints`, `progress`, `status`) VALUES ('$name','$originator','$altcontact ','$problem', '$description', '$po','$archclient', '$urgency', '$technology', '$sprints','$progress', '$status')"; //query to insert new idea
进行更多调试

echo "INSERT INTO idea (`name`, `originator`, `alternative_contact`, `problem`, `description`, `po`, `arch_client`, `urgency`, `technology`, `sprints`, `progress`, `status`) VALUES ('$name','$originator','$altcontact ','$problem', '$description', '$po','$archclient', '$urgency', '$technology', '$sprints','$progress', '$status')";
exit;
$strsq0 = "INSERT INTO idea (`name`, `originator`, `alternative_contact`, `problem`, `description`, `po`, `arch_client`, `urgency`, `technology`, `sprints`, `progress`, `status`) VALUES ('$name','$originator','$altcontact ','$problem', '$description', '$po','$archclient', '$urgency', '$technology', '$sprints','$progress', '$status')"; //query to insert new idea


然后复制此打印的查询并在
phpMyadmin
中运行,检查运行打印的查询后是否有任何错误。

首先,您没有在SQL查询的值部分引用您的值,因此至少会失败。仔细阅读准备好的陈述。(您只需将值作为一个巨大的单列字符串)插入两次
值(““$name.”,“$name
nameremove
id
从插入到idea()请向应用程序添加一些详细信息。在启动查询sql之前,您已连接到数据库?请转义用户提供的值。或绑定参数。否则,您很容易发生sql注入。首先,您没有在sql查询的值部分引用值,因此至少会失败。请在准备时阅读d语句。(您只需将值作为一个巨大的单列字符串)。插入两次
值(““$name.”,“$name
nameremove
id
from insert into idea()请向应用程序添加一些详细信息。在启动查询sql之前,您已连接到数据库?请转义用户提供的值。或绑定参数。否则,您很容易发生sql注入。虽然问题只有一部分,但这是正确的:)另外,我认为您在值部分中包含名称2次,检查alsoi是否不确定引号,因为不确定DBMuch中字段的数据类型更好。现在,如果只有op会使用准备好的语句,那就好了。不是。您只发送了一个列值。查询应该是
插入测试(名称、发起人)值中(‘杀手’、‘本能’);
注意引号。虽然问题只有一部分是正确的:)另外,我认为您在值部分中包含名称2次,检查alsoi是否不确定引号,因为不确定DBMuch中字段的数据类型更好。现在,如果只有op会使用准备好的语句,那就好了。不是。您只发送了一个列值。查询应该是
插入测试(名称、发起人)值中(“杀手”、“本能”);
注意引号。