I have to execute a PHP code just one time to make some changes in my database to have better tables. The code is too heavy and send more than 190000 queries to database (both select and insert).
Now the problem is when I execute it on the browser, form the result on the database and words that I've set to echo to check if it is going in correct way, I can find that it is executed partly. No error/warning/notice appears on the page.
I set max execute time and all the related settings to 1hour but it just take 30minuts and stop the for loop at once.
this is a sample of a part of my code:
for ($i=9;$i<=19909; $i++){
$j=0;
$select= "select synonym from synonym where x_=". $i ."";
//echo $select;
//echo "</br>";
$select_result= mysqli_query($connection,$select);
if (mysqli_num_rows($select_result)>0) {
$row = mysqli_fetch_assoc($select_result);
$arra = explode("،",$row["synonym"]);
}
while ($arra[$j]){
$text=trim($arra[$j]);
$search="select word from semiresult where word='". $text ."'";
$search_result= mysqli_query($connection,$search);
if (mysqli_num_rows($search_result)==0) {
$insert="insert into semiresult (x, word, synonym) values ('','". $text."','".$syn."')";
}elseif (mysqli_num_rows($search_result)>0){
$repeat="UPDATE semiresult SET synonym=CONCAT(synonym,'".$syn2."') where word like'".$arra[$j]."'";
$repeat_result=mysqli_query($connection,$repeat) or die ('request "Could not execute SQL query" '.$repeat);
}