I tried to search for an answer, but I don't really know what my question is. I have been getting Error 504, gateway timeout. This is the code that is giving me the problem.
$query = mysqli_query($dbc,"SELECT
CertificateNumber,Lang,InsuredId FROM policy WHERE Lang = ''"); //rows without Lang
if($query){
while($row = mysqli_fetch_array($query)){
$get_lang = mysqli_query($dbc, "SELECT Lang FROM policy WHERE
CertificateNumber='".$row['CertificateNumber']."'"); //other rows with same certificate number
while($i = mysqli_fetch_array($get_lang)){
if($i['Lang']!=""){ // update lang if any rows with the same certificate number has lang
mysqli_query($dbc, "UPDATE policy SET Lang='". $i['Lang'] ."' WHERE InsuredId='".$row['InsuredId']."'");
}
}
}
}
I am trying to find all the rows without Lang, get lang from other rows with same CertificateNumber and update the original row. This works on smaller tables.(InsuredId is unique for each row, not primary key)
Any help appreciated!
Thanks!
Found solution from (guess I should've searched harder before posting a question): Update row with data from another row in the same table