Closed AbeEstrada closed 12 years ago
I found this on the PHP manual - mysql_query
For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error.
For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success or FALSE on error.
And on the line 809 you're expecting a 'resultset' and is receiving a 'boolean' when I try to insert.
$this->num_rows = mysql_num_rows($result);
And I found this on mysql_num_rows
Retrieves the number of rows from a result set. This command is only valid for statements like SELECT or SHOW that return an actual result set. To retrieve the number of rows affected by a INSERT, UPDATE, REPLACE or DELETE query, use mysql_affected_rows().
Looks like you need and if to detect a select or show and inserts, updates, replaces or deletes to use only one function.
Thanks. I merged your pull request.
There is an error when I try to insert data to the database. Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in sparrow.php on line 809