简体   繁体   中英

Is there a limit to MySQL queries?

I am trying to insert 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM