php - Cannot call more than 100 INSERT queries -


i have insert 1000 records read file , insert db code not working more 100 times. says internal server 500 works fine when run code below 100 times. there settings have apply insert more 100 records?

here code:

<?php      $servername = "**";     $username = "**";     $password = "**";      $dbname = "**";      $con=mysqli_connect($servername, $username, $password,$dbname);      for($i=0; $i<400; $i++){          $query = mysqli_query($con,"insert table_name (column1, column2, column3)                                     values (value1, value2, value3)");               }      $query->close();     $con->close(); ?> 

it's working 100 times. if set loop run more than that, not work ideas?

i unsure if eliminate issue, better try reduce total database calls in code.

since inserting on same table, can in single query. build single query inside loop , use mysqli_query() once after loop finished.

code:

$values=""; for($i=0; $i<400; $i++){     $values.=($i==0?"",",")."('value1','value2','value3')"; } $query=mysqli_query($con,"insert table_name (column1, column2, column3) values $values; 

Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -