Ok, could someone tell me why this isn't working?
(note, I took out all my error checks.  This is just the
relevant code...

$query = "Query that does return row(s)";
$result = mysql( $dbname, $query );

$macroDataArray = mysql_fetch_array( $result );

for( reset( $macroDataArray ); $elementKey = key( $macroDataArray ); next( 
$macroDataArray )) {
    echo "Value for key $elementKey = $macroDataArray[$elementKey]<br>\n";

// this should spit out one line for every element.

That doesn't work but this does:

foreach( $macroDataArray as $elementKey => $elementValue ) {
    echo "Value for key $elementKey = $elementValue<br>\n";

// this spits out 2 lines for every element.

Why?  What's going on?  I could use the second bit of code, but that returns
four pairs for each array element:

0                            5000
KeyName              5000

for example, where the above is the same element.  I really don't need the
numerical "key" (the 0 above), just the name and that's why I need to find
out why the first FOR loop isn't working.

Any ideas?  I've tried everything... :(


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

Reply via email to