1

error code : String size overflow code :

     mysql_connect($servername,$username,$password) or die(mysql_error());
mysql_select_db($dbname);

$sql= "INSERT INTO EM (sourceindex, targetindex,source,target) VALUES ";

for($i=0;$i<$combine_arr_size;$i++){
   for($j=0;$j<$combine_arr_size;$j++){
   $sql.="('$i','$j','$combine_words_array[$i]','$combine_words_array[$j]'),";
 }
}
mysql_query(substr($sql,0,-1));

combine_arr_size is almost 379200,I found a solution is maximum memory_limit setting , is any other choice or code changing ?

1
  • String size overflow code You have a string bigger than 2GB?!? What are you trying to do? I think you want to make some splits in your insert query, so that you won't go over 2GB for a string?!? Commented Apr 10, 2015 at 6:46

1 Answer 1

1
Insert data one by one by executing insertion code in loop, and extend maximum execution time of file.

for($i=0;$i<$combine_arr_size;$i++){
   for($j=0;$j<$combine_arr_size;$j++){
   $sql="INSERT INTO EM (sourceindex, targetindex,source,target) VALUES ('$i','$j','$combine_words_array[$i]','$combine_words_array[$j]')";
 mysql_query($sql);
}
}
Sign up to request clarification or add additional context in comments.

3 Comments

Well maybe to run +/- half a million querys may take a while, OP could simply split it into groups of e.g. 100 sets or so
Sorry I am not getting you.
Well now an explanation why OP's method didn't worked would be nice.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.