Warning: Mysql_affected_rows(): Supplied Argument Is Not a Valid MySQL-Link Resource

  • Home /
  • Blog Posts /
  • Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource

Warning: mysql_affected_rows(): supplied argument is not a valid MySQL-Link resource

You have just gotten a warning when trying to check if an inserted row was successful but when calling mysql_affected_rows(mysql_query(“INSERT INTO……”)) you get a warning telling you that the supplied argument is not a valid MySQL-Link resource.

This is because mysql_query INSERT actually returns true or false and not a resource id.

So rather do this:

if (mysql_query(“INSERT INTO…”))