我在mysql icalproperty
中有以下表格ipid propertyid name roomtypename roomtypecode 1 1测试 2 2测试 3 3 test2
我想将值插入roomtype和roomtypecode 我的代码是:
foreach($rtypes1 as $roomtype)
{
$sSQL = sprintf(
"INSERT INTO icalproperty
(roomtypename, roomtypecode)
VALUES ('%s','%s'),
WHERE property_id=".$villa['hotelid']."
",
mysql_real_escape_string($roomtype['roomtypedesc']),
mysql_real_escape_string($roomtype['roomcode'])
);
}
$rResult = mysql_query($sSQL);
if(mysql_errno() > 0){
printf(
'<h4 style="color: red;">Query Error:</h4>
<p>(%s) - %s</p>
<p>Query: %s</p>
<hr />',
mysql_errno(),
mysql_error(),
$sSQL
);
}
我有以下错误消息
查询错误:
(1064) - 您的SQL语法出错;检查与您的MySQL服务器版本相对应的手册,以便在&#39; WHERE property_id = 842&#39;附近使用正确的语法。在第7行
查询:INSERT INTO icalproperty(roomtypename,roomtypecode)VALUES(&#39; Villa Charmony&#39;,&#39; 2825&#39;),WHERE property_id = 842
任何解决方案?