TechFanDan
TechFanDan

Reputation: 3478

Odd mysql_fetch_array behavior

Here are my two offending lines from a reused function:

//snip
$req = mysql_query($sql,$db) or die(db_query_error($sql,mysql_error()));
//Breakpoint A
$data = mysql_fetch_array($req);
//Breakpoint B
//snip

At Breakpoint A:

At Breakpoint B:

The problem is that on this page, EVERY query works except one. For the query that doesn't work, when the SQL is ran through manually, it works and returns the proper value. I have queries running before and after this call that work properly.

Edit #1 - print_r, in our custom debug function, was being used. - var_dump of $data shows that it's "bool(false)". Something is wrong with either the $db or $sql variables.

Edit #2 This issue has nothing to do with MySQL. It had something to do with our publication process and where the data was located during this process.

Upvotes: 1

Views: 178

Answers (1)

genesis
genesis

Reputation: 50976

you can try

 var_dump($data);

also try to change

mysql_fetch_array();

to

mysql_fetch_assoc();

or to

mysql_fetch_row();

if you use numeral indexes.

I think these tests will you give your answer

Upvotes: 2

Related Questions