PDA

View Full Version : help creating a fetch_array function.


gengar003
10-25-2003, 10:53 PM
Alright. I've got a DB_SITE object and DB_SITE class set up, with a working

$DB_SITE->connect(blah blah blah);

I want to add a function,

$DB_SITE->fetch_array, using mysql_fetch_array, however it doesn't seem to work for me.

Could someone help me out? (i.e. - write a quick one?)

Ironically, I've got mysql_fetch_array built into my $DB_SITE->query(); function, and it works like a charm.

I'm using $DB_SITE->query_simple() to query the database without automatically putting the data into an array thingie...

Thankyou.

Xenon
10-26-2003, 02:03 PM
just look into db_mysql.php of vbulletin, to see how they did it :)

gengar003
10-26-2003, 03:25 PM
I did... but they use lots of other variables in it, defined elsewhere in the script....

filburt1
10-26-2003, 03:33 PM
I did... but they use lots of other variables in it, defined elsewhere in the script....
All that the DB_Mysql class is a wrapper. So:

function fetch_array($result)
{
return mysql_fetch_array($result);
}

gengar003
10-26-2003, 03:54 PM
Ok, thank you, it works.


Also, if you're testing to see if a statement is false, would you use

if ($statement=="false"){


or


if ($statement=false){


??

Xenon
10-26-2003, 04:04 PM
if ($statement=false){


as you use just one = you'd get a problem ;)

use if (!statement) {