get rid of numeric key?
Posted: Thu Apr 26, 2007 1:41 pm
The Ninja Space Goat | Please use
Question:
Why do I get the numeric key/value?
How can I stop it from appearing?
Thx.
The Ninja Space Goat | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I'm retreiving results from mySQL using php4:Code: Select all
while($row = $db->sql_fetchrow($result, MYSQL_ASSOC))
{
$results_array[$count] = $row;
$count++;
}
Then putting the array in a session var:
$_SESSION["xxx"] = $results_array;
Then checking the key value for export to csv:
foreach ($_SESSION["xxx"] as $r) {
foreach ($r as $key => $value) {
echo key=$key || value=$value ;
}}
/*
Snipped output:
key=0 || value=9
key=id || value=9*/Why do I get the numeric key/value?
How can I stop it from appearing?
Thx.
The Ninja Space Goat | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]