Pete,
 
Thanks for the reply.
 
However, if I do this, which is putting it with a loop:
 
while(list($key, $value) = each($arr = $db->Fetch_array($sql))){
    echo $key." => ". $value. "<br>"; 
}

 
I get this error:
 
0 => 1
0 => 3

Warning: Variable passed to each() is not an array or object in
d:\www\youincharge\test\functions\functions.php on line 239

 
Greg

  _____  

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Pete
Sent: Friday, August 19, 2005 3:18 PM
To: [email protected]
Subject: Re: [php_mysql] Looping through returned rows


In message <[EMAIL PROTECTED]>, libertyhosting
<[EMAIL PROTECTED]> writes
>$count = $db->Num_rows($sql);
>
>echo $count."<p>";
>                                         
>$arr = $db->Fetch_array($sql);
>                                                         
>foreach($arr as $key=>$value){
>   echo $key." => ". $value. "<br>";   
>}
>exit;
>
>Now, $count returns 2 record, however only one is being returned in 
>the foreach loop.
>
>Can anyone shed some light?

You have only asked for one row,
>$arr = $db->Fetch_array($sql);

you need a loop around it...

-- 
Pete Clark

http://www.hotcosta.com
http://www.spanishholidaybookings.com




The php_mysql group is dedicated to learn more about the PHP/MySQL web
database possibilities through group learning. 



  _____  

YAHOO! GROUPS LINKS 


        
*        Visit your group "php_mysql
<http://groups.yahoo.com/group/php_mysql> " on the web.
  

*        To unsubscribe from this group, send an email to:
 [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> 
  

*        Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service
<http://docs.yahoo.com/info/terms/> . 


  _____  




[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12h4qtuup/M=362335.6886445.7839731.1510227/D=groups/S=1705375618:TM/Y=YAHOO/EXP=1124486776/A=2894361/R=0/SIG=13jmebhbo/*http://www.networkforgood.org/topics/education/digitaldivide/?source=YAHOO&cmpgn=GRP&RTP=http://groups.yahoo.com/";>In
 low income neighborhoods, 84% do not own computers. At Network for Good, help 
bridge the Digital Divide!</a>.</font>
--------------------------------------------------------------------~-> 

The php_mysql group is dedicated to learn more about the PHP/MySQL web database 
possibilities through group learning.  
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php_mysql/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to