Reputation: 419
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 ?
Upvotes: 1
Views: 2907
Reputation: 68
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);
}
}
Upvotes: 1