while query problem
Posted: Mon Jan 12, 2004 5:48 pm
Hello!
When I try the following script, only the value in the last field gets ticked:
any ideas?! Thank you in advance! 
When I try the following script, only the value in the last field gets ticked:
Code: Select all
<?
$nameID = "2";
$db = mysql_connect("localhost", "", "") or die("unable to connect to the database");
mysql_select_db("test", $db) or die("unable to select the database");
$sqlA = "SELECT * FROM Anames";
$objSQLA = mysql_query ($sqlA) or die ("Query 1 Failed: ".mysql_error());
$sqlB= "SELECT Enames FROM Bnames WHERE namesID ='$nameID'";
$objSQLB = mysql_query ($sqlB) or die ("Query 2 Failed: ".mysql_error());
$rowB = mysql_fetch_assoc($objSQLB);
while ($names = mysql_fetch_array($objSQLA)) {
echo $names["names"];
echo "<input type="checkbox" name="name"";
if($names["names"] == $rowB["Enames"]) {
echo "checked";
}
echo ">";
}
?>