[PHP] Mysql fetch_row()

2004-06-20 Thread Gerben
when I call mysql_fetch_row() I get an array, but this Array doesn't have
the fieldnames as array-keys.
I've seen several codes from others where they use something like

print $row['key'];

This doesn't work on my server. Is this because my server-software is too
old or am I using the wrong function?
PHP Version 4.3.4
mySQL version: 3.23.54

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysql fetch_row()

2004-06-20 Thread Greg Donald
On Sun, 20 Jun 2004 19:05:31 +0200, Gerben [EMAIL PROTECTED] wrote:
 
 when I call mysql_fetch_row() I get an array, but this Array doesn't have
 the fieldnames as array-keys.
 I've seen several codes from others where they use something like
 
 print $row['key'];

'key' simply needs to be the primary key's field name you made when
you made the table or whatever.  If you named you primary key 'key'
then your good, else use what it's really named.  You can use PHP's
key() function with an associative array but I find I rarely need it
as I usually already know the field names and the primary keys of all
my tables.


-- 
Greg Donald
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] Mysql fetch_row()

2004-06-20 Thread rich
 when I call mysql_fetch_row() I get an array, but this Array doesn't have
 the fieldnames as array-keys.
 I've seen several codes from others where they use something like
 
 print $row['key'];
 
 This doesn't work on my server. Is this because my server-software is too
 old or am I using the wrong function?

...the wrong function - use mysql_fetch_assoc()

rich

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Mysql fetch_row()

2004-06-20 Thread Daniel Clark
Use  mysql_fetch_assoc()  for fieldnames

when I call mysql_fetch_row() I get an array, but this Array doesn't have
the fieldnames as array-keys.
I've seen several codes from others where they use something like

print $row['key'];

This doesn't work on my server. Is this because my server-software is too
old or am I using the wrong function?
PHP Version 4.3.4
mySQL version: 3.23.54

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php