trouble with sql statement results
Posted: Wed Jan 31, 2007 5:33 pm
i have the following code:
what this code should do is run a select statement and then pass the output to a variable and display it.
The query runs fine as fail is not outputted. however the next part is the problem. test ok is not out put. therefore i think there must be something wrong with my statement but i dont know what. can anyone heklp?
thanks
Code: Select all
$getunitid = @mysql_query("SELECT unitid FROM units WHERE name = '$newingname'");
if(!$getunitid)
{
echo'<p>fail ' . mysql_error() . '</p>';
}
while ($row = mysql_fetch_array($getunitid))
{
$unitid = $row['unitid'];
echo"test ok!";
echo"$unitid";
}The query runs fine as fail is not outputted. however the next part is the problem. test ok is not out put. therefore i think there must be something wrong with my statement but i dont know what. can anyone heklp?
thanks