Hi,
This is maybe a bit more of a MySQL question, although the MySQL insert query is working correctly.
I'm inserting some data ($category) into a MySQL table (test), and trying to get some feedback in the event that either the query is successful or unsuccessful.
I’m using the below code, but for some reason mysql_affected_rows continuously returns false. I have checked the table, and the information is being inserted, so I know the insert query is successful. Why isn’t mysql_affected_rows detecting the update?
$result=mysql_query("INSERT INTO `test` (`data`) VALUES ('$category')");
if (mysql_affected_rows($result) < 1){
$feedback .= ' ERROR - New Category not Added - Database Error ';
return false;
} else {
$feedback .= ' SUCCESS - New Category Added ';
return true;
}