Hi,
Forgive me if this is a simple error. I am trying to update a field or two with the following code. The database gets updated correctly but it throws an error to the web browser screen. For the life of me, I can't figure out what I'm doing wrong. I've checked my syntax and it seems to be fine. What am I missing?
The error message is: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in removeSessionHandle.php on line 60
(line 60 is the beginning of the while loop)
// Trim the incoming data.
$eid = trim($eid);
$session = trim($session);
print $session;
print $eid;
// if they choose all to delete
if ($session == "all")
{
$sql = "DELETE from wFinEdNov2004 WHERE eid = '$eid'";
}
// if they choose session 1 to delete
else if ($session == "session1")
{
$sql = "UPDATE wFinEdNov2004 SET session1='' WHERE eid = '$eid'";
}
// if they choose session 2 to delete
else if ($session == "session2")
{
$sql = "UPDATE wFinEdNov2004 SET session2='' WHERE eid = '$eid'";
}
else
{
print "error";
}
//********************************************************************************
// Run query**
$result = mysql_query($sql) or die("Could not update db: " . mysql_error());
while ($row = mysql_fetch_array($result))
{
print ("$row[session] was deleted successfully.\n");
}
TIA
🙂