Hey all,
I've created a database access class for use with my php scripts. The class has a method called dbFetchArray() which, as i'm using it, is basically just a wrapper for mysql_fetch_array(). Below is the code for my method.
function dbFetchArray($dbQResult) {
this->_dbh['resultArray'] = mysql_fetch_array($dbQResult) or die('query failed');
return $this->_dbh['resultArray'];
}
So here's the problem. I run a query then shove the result into $dbObject->dbFetchArray($myresult) like that inside of a while loop (so that i may loop through the results), and everything works fine - it pulls the results of the query into an array just as it should and the loop cycles through them and prints them to the page, HOWEVER it also prints 'query failed', as it should if it had actually failed!
I tried replacing the or die('query failed'); with or die(mysql_error()); to see if i could come up with any ideas as to why it's doing this, but no avail. mysql_error() prints nothing.
It's as if it's just executing the stuff after the or regardless of wether the query failed or not.
Any help would be greatly appreciated!
(note: if i simply use mysql_fetch_array naked, outside of the object with the same result pointer and all that, everything works fine)
Thank you.