faqts : Computers : Programming : Languages : PHP : Database Backed Sites : MySQL

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

15 of 25 people (60%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

Does mysql_query return 1 or 0 on success?

Jan 1st, 2009 23:01
Venus venui, Philip Olson, Alexander Berkman, Guest, http://www.php.net/mysql-query


On failure mysql_query() returns boolean false.  What mysql_query() 
returns on success depends on the type of query.
From the PHP manual: http://www.php.net/mysql-query
"Only for SELECT,SHOW,EXPLAIN or DESCRIBE statements mysql_query() 
returns a resource identifier or FALSE if the query was not executed 
correctly. For other type of SQL statements, mysql_query() returns TRUE 
on success and FALSE on error. A non-FALSE return value means that the 
query was legal and could be executed by the server. It does not 
indicate anything about the number of rows affected or returned. It is 
perfectly possible for a query to succeed but affect no rows or return 
no rows."
If mysql_query() fails consider using mysql_error() to find the error.
------------------------------------------------------------------------
http://voyage-londres.blogspot.com
http://meine-valentine.blogspot.com
http://calatoriesingapore.blogspot.com/
http://guia-de-saude.blogspot.com
http://valentineideer.blogspot.com
http://gaveideer1.blogspot.com
http://gavoride.blogspot.com
http://resorchile.blogspot.com/
http://reiseschweiz.blogspot.com/
-----------------------------------------------------------------------