Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

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

Posts: 36
Trades: 0
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
 
 
Register now for full access!
Old 03-18-2005, 02:43 PM
Phaedrus's Avatar
Ultra Talker

Posts: 271
Location: CA
Trades: 0
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
   
}

__________________

Please login or register to view this content. Registration is FREE
Phaedrus is offline
Reply With Quote
View Public Profile
 
Old 03-27-2005, 10:17 AM
Experienced Talker

Posts: 36
Trades: 0
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 Search this Thread
Search this Thread:

Advanced Search

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

BB 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.37485 seconds with 12 queries