Ok, here is the code for how I get the IDs that I need:
PHP Code:
//--- get the maximum id ---------
$wclause = 0;
$maxid=0;
$query2 = "SELECT ID FROM [Cell Equipment Complete]";
if(isset($_GET['CELLNUMBER']))
{
if($_GET['CELLNUMBER'] != '*')
{
$query2 .= " WHERE CELLNUMBER = " . $_GET['CELLNUMBER'];
$wclause = 1;
}
if($_GET['TAG_ID'] != '*')
{
if($wclause == 0)
{
$query2 .= " WHERE TAG_ID = " . $_GET['TAG_ID'];
$wclause = 1;
}
else
$query2 .= " AND TAG_ID = " . $_GET['TAG_ID'];
}
if($_GET['TAG_NUM'] != '*')
{
if($wclause == 0)
$query2 .= " WHERE TAG_NUM = " . $_GET['TAG_NUM'];
else
$query2 .= " AND TAG_NUM = " . $_GET['TAG_NUM'];
}
} // end isset check
$result2 = mssql_query($query2);
$maxid = mssql_num_rows($result2);
and here is the code for moving forward one record before I added the search function:
PHP Code:
switch($_GET['dir'])
{
//----------------Go forward one record----------------------------------------------
//---------------------------------------------------------------------------------------
case "next":
$go=0;
while($go<1)
{
// --- grab the next valid id
$id++;
if($id > $maxid)
{
$id=0;
}
else
{
$query2 = "SELECT CELLNUMBER FROM [Cell Equipment Complete] WHERE ID = " . $id;
$result2 = mssql_query($query2);
$row2 = mssql_fetch_array($result2);
if($row2[0] != "")
$go=1;
}
}
break;
I'm just not sure how to modify that to grab the next one out of the results that are returned from the first bit of code.