[PHP]
$result = mysql_query("UPDATE answersmod".$ModNum." SET answer='$A1' WHERE user_id='$lg_name' AND Q_Num = '$Q_Num'");
if (mysql_affected_rows($result) == 0)
{
// No records updated, so add it
$result = mysql_query("INSERT INTO answersmod".$ModNum." (User_ID, Q_Num, Answer) VALUES ('$lg_name', '$Q_Num', '$A1')");
if (mysql_affected_rows($result) == 0)
{
echo "No insert or update performed";
} else { echo "All done";}// end if
}//end if
[/PHP]
It does not update or insert. instead i get the following:
Expand|Select|Wrap|Line Numbers
- Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource in C:\Program Files\xampp\htdocs\Lilly\PageFiles\ModDisplayQuestions.php on line 62
- Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource in C:\Program Files\xampp\htdocs\Lilly\PageFiles\ModDisplayQuestions.php on line 67
- No insert or update performed
any ideas? I have to have this completed by tuesday afternoon so a speedy reply would be much appreciated!
thanks in advance for any help