Reputation:
I get a Warning: mysql_affected_rows() expects parameter to be resource, boolean give in c:\program files\EasyPHP......line 71.
when i check the database the row is updated, but i still get this error message
line 71 is if ($duplicates < 0);
$query = mysql_query("UPDATE courses
SET
course_code = '".$course_code."',
course_title = '".$course_title."' ,
course_unit = '".$course_unit."'
WHERE
course_code = '".$course_code."'")
or die(mysql_error());
$duplicates = mysql_affected_rows($query);
if ($duplicates > 0)
echo"<div id=\"contentRight\">";
echo"<idv id=\"msg\">" ; echo "You have a updated one Course " ;
echo"</div>" ;
echo"</div>" ;
exit();
Upvotes: 0
Views: 47
Reputation: 449783
Unlike many other mySQL functions, mysql_affected_rows()
doesn't take a query resource as the first parameter: It returns the number of affected rows in the last operation, no matter when that happened.
int mysql_affected_rows ([ resource $link_identifier ] )
What you can pass to it optionally is the database connection resource. But that's necessary only when you deal with more than one of them.
Upvotes: 4