It will be like
$records = mysql_query("UPDATE `table` SET a='$b', b='$c' WHERE id = '$id' ");
$affected_rows = mysql_affected_rows($records);
if($affected_rows >= 1) {
echo "Updated ".$affected_rows." rows";
}
Need to remove $
before mysql_query
.And consider that table
is your table name and also makesure that your connection to the DB is active.
And Try to avoid mysql_*
statements due to the entire ext/mysql PHP
extension, which provides all functions named with the prefix mysql_*
, is officially deprecated as of PHP v5.5.0
and will be removed in the future.
There are two other MySQL
extensions that you can better Use: MySQLi
and PDO_MySQL
, either of which can be used instead of ext/mysql
.