I have two tables that I need to search for information related to a transaction. Not sure if this is the most efficient way of doing it but, I am doing something like:
$sqlstr="select * from abc for var1='John'";
$sqlres=mssql_query($sqlstr);
$foundrecs=mssql_num_rows($sqlres);
$ABCresultststable = mssql_fetch_array($sqlres, MSSQL_BOTH);
while ($ABCrestultstable = mssql_fetch_array($sqlres, MSSQL_BOTH)) {
$owner=$ABCresultstable[1];
echo "
<input type='text' value='$ABCresultstable[2]'>
.......
other HTML stuff
.......";
$sqlstr="select * from xyz for var1='$owner'";
$sqlres=mssql_query($sqlstr);
$foundrecs=mssql_num_rows($sqlres);
$XYZresultststable = mssql_fetch_array($sqlres, MSSQL_BOTH);
echo "
<input type='text' value='$XYZresultstable[3]'>
.......
.......";
};
The problem seems to be when I do the "select" for XYZ, I lose the "While" pointer. It exits the "while" statement even there are more records to display from ABC.
Any suggestion will be appreciated. Thanks.