04-03-2008, 06:06 PM
|
#3 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
|
Quote:
Originally Posted by Salathe
Most likely, this problem is with your use of mysql_fetch_array ( PHP Manual page). You don't provide any value for the second argument ( result_type), so it falls back to the default which is MYSQL_BOTH (other allowed values are MYSQL_ASSOC and MYSQL_NUM). Because of this, the fetched array will contain both the numeric (the column number) and associative (the column name) keys into the result.
To fix the behaviour for your needs, you need to put in one of MYSQL_NUM/ASSOC as the second argument -- most likely MYSQL_ASSOC for most normal usage.
Just to get an idea of what's going on for your own learning, try the following with using the different constants and see what they return. You'll understand clearly if you do that.
PHP Code:
$poemlist = $tanaxia['poems']->getPoems();
print_r($poemlist);
|
Yes, it works now 
Thanks 
I already tried with print_r and var_dump but none of them made sense to me at the time
Anyways, it's strange, because I don't have to do this on all my mysql_fetch_array queries =//
__________________
|
|
|
|