我知道这是一个非常基本的问题,但我已经被困了 3 个小时,无法弄清楚什么是错的。任何人都可以告诉我这个查询有什么问题吗?
insert into user_to_deliverable set d_id = 1 u_id = 4
我有以下错误
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'u_id = 4' at line 1
我根据答案更正了查询,但它仅在 phpmyadmin 上运行,而不是通过代码插入,这是我的代码
foreach($_POST['user'] as $k=>$v) {
echo $ins_u_deliverable = "insert into user_to_deliverable set d_id = ".$_POST['dlvrbl_id'].", u_id = $v "."<br />";
mysql_query($ins_u_deliverable);
}
用户的数组是
[user] => Array
(
[0] => 4
[1] => 5
)