Reply
Looping through a MySql row using PHP
Old 03-18-2005, 01:58 PM Looping through a MySql row using PHP
Experienced Talker

Posts: 36
Hi:

How can I loop through a MySql row retrieving only values that do no equal to zero (assuming you have connected and selected database)?

Thanks for the help.
common_sense is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 03-18-2005, 03:43 PM
Phaedrus's Avatar
Ultra Talker

Posts: 271
Location: CA
It's probably easier to do that with your SQL statement... but, with PHP you could do it like this:

PHP Code:
$row mysql_fetch_array($result);

foreach(
$row as $value)
{
   if(
$value != 0)
   {
      
//value isn't zero - do something
   
}
   else
   {
      
//value is zero - do something else
   
}

__________________
Free Teacher Websites
Phaedrus is offline
Reply With Quote
View Public Profile
 
Old 03-27-2005, 11:17 AM
Experienced Talker

Posts: 36
Thanks for the tip!
common_sense is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Looping through a MySql row using PHP
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11701 seconds with 12 queries