Mulitple variable containing "for loop" is not working in my code...

Posted by OM The Eternity on Stack Overflow See other posts from Stack Overflow or by OM The Eternity
Published on 2010-05-12T09:29:21Z Indexed on 2010/05/12 9:34 UTC
Read the original article Hit count: 199

Filed under:
|

Below is the code I am working with and the last for loop i am iterating is not working... I think i am doing something wrong using multiple variable in a for loop,also I m aware of the fact that it can be done.

$updaterbk = "SELECT j1. *
FROM jos_audittrail j1
LEFT OUTER JOIN jos_audittrail j2 ON ( j1.trackid != j2.trackid
AND j1.field != j2.field
AND j1.changedone < j2.changedone )
WHERE j1.operation = 'UPDATE'
AND j2.id IS NULL
";

$selectupdrbk = mysql_query($updaterbk);
while($row1 = mysql_fetch_array($selectupdrbk))
{   
    $updrbk[] = $row1;
}

foreach($updrbk as $upfield)
{
if(!in_array($upfield['field'],$exist))
{
    $exist[] = $upfield['field'];
    $existval[] = $upfield['oldvalue'];

    //echo $updqueryrbk = "UPDATE `".$upfield['table_name']."` SET ";
}
}
print_r($existval);

for($i=0;$j=0;$i<count($exist);$j<count($existval);$i++;$j++)
{ 
$updqueryrbk.= $exist[$i]['field']."=".$existval[$j]['oldvalue'].",";
$updqueryrbk.="=";
$updqueryrbk.= $existval[$j]['oldvalue'];

$updqueryrbk.=",";

}

© Stack Overflow or respective owner

Related posts about php

Related posts about forloop