Hi,

I'm trying to echo out the field names used as key values in a
mysql_fetch_array:

$link_id = mysql_connect("localhost", "root", $pass);

mysql_select_db("database", $link_id);

$result = mysql_query("select * from lists where id = 1", $link_id);

$rowData = mysql_fetch_array($result);

while (list($fieldName) = each($rowData))
{ echo "$fieldName,"; }

I'm expecting to get this:

id,listname,joinconfirm,leaveconfirm,homepage,author,canjoin,bannedemails,de
scription,subject,masteremail,

but instead getting this:

0,id,1,listname,2,joinconfirm,3,leaveconfirm,4,homepage,5,author,6,canjoin,7
,bannedemails,8,description,9,subject,10,masteremail,

Why are the index numbers for the array showing up?  From the docs,
mysql_fetch_array should create an array of field names to field values...?
To make things worse, if I also echo the data:

while (list($fieldName,  $fieldValue) = each($rowData))
{ echo "$fieldName,$fieldValue," ;}

Then a value is echoed after both the index number and the field value, eg:

0,1,id,1,1,testlist,listname,testlist,  etc...

What am I doing wrong?

Regards,
Jaxon


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to