note 35475 added to function.mysql-fetch-array
| From: | plugboy2 at hotmail dot com | Date: | Tue, 02 Sep 2003 13:11:11 +0000 |
| Subject: | note 35475 added to function.mysql-fetch-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-55466@lists.php.net to get a copy of this message | ||
I'm looking to test if a variable is alread in the database or not but it keeps telling me that
"Supplied argument is not a valid MySQL result resource on line 8"
$result = mysql_query("SELECT name FROM trivia_pheonix WHERE name=$name");
while($row = mysql_fetch_array($result)) //line 8
{
if ($name == $row[name]) {
$update = mysql_query("UPDATE trivia_pheonix SET point=point+$points,spoint=spoint+$spoints
WHERE name=$name");
print ("<br>Person score updated successfully");
}
else
{
$add = mysql_query("INSERT INTO trivia_pheonix VALUES ('$name', '$points',
'$spoints')");
print ("<br>Person added to the scores successfully");
}
}
----
Manual Page -- http://www.php.net/manual/en/function.mysql-fetch-array.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35475
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35475&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35475&report=yes