有人能告诉我为什么这个查询是错误的吗?
$tbl_name = "Attributes";
$pieces = //some array
//other variables... blah blah blah
$query = "INSERT INTO $tbl_name (Word, What, When) VALUES";
foreach($pieces as $word){
$query .= "('$word', '$What', '$When'),";
}
$query = substr($query, 0, -1); //to remove the last comma
mysql_query($query) or die(mysql_error());
如果你能说出来,我正在尝试用一个查询插入多行。当我尝试运行它时,我遇到了语法错误,但我 99.9999% 确定没有拼写错误。通过尝试像这样一次插入多行,我做错了什么吗?