How to get the next row from the Database table? Such that the row might be incremented row that is if structure has a field called "id" then the row can be id++ or very next incremented row, but it may also b any other id containing row (NOT VERY NEXT) , (because the ids could be deleted from the table).
I am using Mysql Database below is my code..
mysql_select_db('pranav_test');
$seletaudit = mysql_query("SELECT * FROM jos_audittrail WHERE live = 0");
while($row2 = mysql_fetch_array($seletaudit))
{
$audit[] =$row2;
}
$trackid = array();
$tracktable = array();
$i = 0;
foreach($audit as $val)
{
$trackid[$i] = $val['trackid'];
$tracktable[$i] = $val['table_name'];
if($i!=0)
{
$prev_id = $trackid[$i-1];
$prev_valtab = $tracktable[$i-1];
}
if($val['operation'] == 'INSERT')
{
if($tracktable[$i]!=$prev_valtab)
{
$inserttable = "INSERT INTO '".$tracktable[$i]."' (";
}
if($tracktable[$i]==$prev_valtab)
{
$insertfield .= "'".$val['field']."', ";
}
if($tracktable[$i]==$prev_valtab)
{
$insertfield .= "]";
$insertfield = str_replace(", ]",")",$insertfield);
}
}
}
here above I need t know whats going to be my next rows's "table_name" field contain... how can i do that....? Please help for fetching the next row in the for loop to get it checked.