Date: 06/20/02
- Next message: Richard Black: "RE: [PHP-DB] array problem"
- Previous message: Theodore Hope: "[PHP-DB] Oracle dbms_obfuscation_toolkit MD5 and PHP MD5 ?"
- Next in thread: Richard Black: "RE: [PHP-DB] array problem"
- Reply: Richard Black: "RE: [PHP-DB] array problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi, I am carrying out MySQL queries and putting the results into arrays for
easy handing in PHP. However, I have a small problem. I want to
automatically display the query result by printing out the array using a
simple for each loop like so:
$result = mysql_query($query);
$row = mysql_fetch_array($result);
foreach($row as $key => $val) {
if ($val != NULL){
echo "$key is set to $val<br>";
}
}
but when I do this I get two entries for each field, one with the numerical
key and the other with the field name key.
0 is set to field1data
field1name is set to field1data
1 is set to field2data
field1name is set to field2data
etc ..
How to just get the output with the field names?
Mike
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
- Next message: Richard Black: "RE: [PHP-DB] array problem"
- Previous message: Theodore Hope: "[PHP-DB] Oracle dbms_obfuscation_toolkit MD5 and PHP MD5 ?"
- Next in thread: Richard Black: "RE: [PHP-DB] array problem"
- Reply: Richard Black: "RE: [PHP-DB] array problem"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

