www.php.net says:
>>>>>>>> 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.>>>>>>>>>
So if zero rows come back the function will still return true? It only
returns false if something much more serious happened? My script below
is failing somewhere and I'm trying to trouble shoot.
// 11-16-04 - Costin set it up so we do one set of actions for
SELECT, SHOW, EXPLAIN, and DESCRIBE
// queries, and another for all others. For these 4 we return a
link id, otherwise we simply
// return true or false.
if (stristr($query, 'SELECT') || stristr($query, 'SHOW') ||
stristr($query, 'EXPLAIN') || stristr($query, 'DESCRIBE')) {
$this->pp_queryid = @ mysql_query($query, $this->pp_linkid);
if ($this->pp_queryid) {
$this->notifyObject->notify("McDatastoreConnector",
"databaseQuerySuccess");
$this->pp_firstquery = 1;
return $this->pp_queryid;
} else {
$this->resultsObject->error("In query(), in
McDatastoreConnectorMySql, we were not able to run our query.",
"McDatastoreConnectorMySql");
$this->notifyObject->notify("McDatastoreConnector",
"databaseQueryError");
$this->error();
}
} else {
$queried = @ mysql_query($query, $this->pp_linkid);
if ($queried) {
$this->notifyObject->notify("McDatastoreConnector",
"databaseQuerySuccess");
return true;
} else {
$this->resultsObject->error("In query(), in
McDatastoreConnectorMySql, we were not able to run our query.",
"McDatastoreConnectorMySql");
$this->notifyObject->notify("McDatastoreConnector",
"databaseQueryError");
$this->error();
}
}