开发者

Is there a limit to MySQL queries?

开发者 https://www.devze.com 2022-12-11 06:26 出处:网络
I am trying to 开发者_如何学Goinsert 10,000+ fields into my database? Is there a limit? $sql = \'INSERT INTO `_\'.$test.\'` (`user`, `pass`) VALUES \' . preg_replace($test, $replace, $final_check) .

I am trying to 开发者_如何学Goinsert 10,000+ fields into my database? Is there a limit?

$sql = 'INSERT INTO `_'.$test.'` (`user`, `pass`) VALUES ' . preg_replace($test, $replace, $final_check) . ';';
mysql_query($sql) or die(mysql_error());

Every time I try to insert the data, it fails.


I believe it's your query. Make sure you are importing the right data, and it shouldn't fail.
Echo the $sql to test it.

echo $sql


There is a packet size limit in the MySQL protocol. If your SQL statement exceeds that, it can't send it to the server. The limit was for a very long time 16Mb, but fairly recent versions have raised it higher.

Also, check that you are enclosing each row's worth of data in it's own parentheses.

0

精彩评论

暂无评论...
验证码 换一张
取 消