Hi,
I am trying to run a query once and then reuse the result set in a loop to compare so that to know whether to have a checkbox "checked" or not. Something is not right because I don't get any of them checked. I have a feeling I need something like an BOF statement but I am not sure of the syntax.
Thanks, here is the code:
$query = "select * from tblService_County where serviceid = {$serviceid};";
if( !$c->query($query) ){
echo "error querying to the db. $query";
echo $c->getError();
exit();
}
$selectedcounty=mysql_query($query);
$numselectedcounty=mysql_numrows($selectedcounty);
while($county = $c->getObject() ){
echo "<br>{$county->county}</td><td><input type=\"checkbox\" name=\"county[]\" value = \"{$county->countyid}\" ";
$i=0;
[B]while ($i < $numselectedcounty)
{
if($selectedcounty->countyid == $county->countyid )
echo "checked";
$i++;
}[/B]echo "><br>\n";
}