日期:2014-05-16  浏览次数:20827 次

插入多条同样记录的语句,对吗?大家帮忙
for($i=1;$i <5;$i++)
{
$sql= "INSERT   INTO   `lo`   (   `id`   ,   `username`   ,   `image`   ,   `place`   ,   `email`   ,   `web`   ,   `qq`   ,   `info`   ,   `secret`   ,   `ip`   ,   `reply`   ,   `time`   )  
VALUES   (
'265 ',   '123 ',   '1 ',   ' ',   ' ',   ' ',   '0 ',   '123456 ',   ' ',   ' ',   ' ',   '0000-00-00   00:00:00 '
); ";
mysql_query($sql);
}
请问这样写对吗?
为什么我执行出错?
错误
SQL   查询:  

FOR   (

$i   =1;


MySQL   返回:  

#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   'for($i=1 '   at   line   1  

谢谢大家帮忙了

------解决方案--------------------
你不会是把这段程序作为SQL脚本在MySQL中执行吧?
------解决方案--------------------
这人好象就是
呵呵