is the array from mysql_fetch_array really an array (or does it just pretend ) ???? Creating an array with mysql table fieldnames in it....

From: Date: Tue, 25 Jul 2000 12:20:29 +0000
Subject: is the array from mysql_fetch_array really an array (or does it just pretend ) ???? Creating an array with mysql table fieldnames in it....
Groups: php.db php.general 
Request: Send a blank email to php-db+get-1457@lists.php.net to get a copy of this message
Hi, I have been trying to solve this one for a while now, but i still = haven't gotten over the problem though i really need to. I am trying to = create an array with all the names of the fields of a mysql table in it. = I use the following code: while ($fieldnames=3D$check->fetch_fields()) { echo "this is a fieldname: $fieldnames[name]"; $fields[]=3D $fieldnames[name]; } fetch_fields is a function in a class which goes as follows: function fetch_fields()=20 { return mysql_fetch_field($this->Query_ID); } nothing fancy. However, this code returns the following: this is a fieldname: ID Warning: Variable $fieldnames is not an array or string in = /htdocs/functions.inc.php on line 37 this is a fieldname: name Warning: Variable $fieldnames is not an array or string in = /htdocs/functions.inc.php on line 37 this is a fieldname: email Warning: Variable $fieldnames is not an array or string in = /htdocs/functions.inc.php on line 37 this is a fieldname: photo Warning: Variable $fieldnames is not an array or string in = /htdocs/functions.inc.php on line 37 this is a fieldname: added Warning: Variable $fieldnames is not an array or string in = /htdocs/functions.inc.php on line 37 The fact that it manages to deal with the echo properly but not with the = assigning of fieldnames[name] to a new array really gets me.... What on = earth am I doing wrong ??????????????? nick

« previous php.db (#1457) next »