TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Advanced PHP Programming (http://www.talkphp.com/advanced-php-programming/)
-   -   re run PHP if ($row == NO) (http://www.talkphp.com/advanced-php-programming/5171-re-run-php-if-row-no.html)

russellharrower 12-15-2009 09:22 AM

re run PHP if ($row == NO)
 
Hi i am looking for away to re-run the PHP (without a page reload) if the if statement does not = what I want it to =.

I have googled, binged and yahooed but no answer that helped.

sketchMedia 12-15-2009 10:11 AM

There are a few ways to get code to repeat if a condition is not met, to name a few:

While, do while, for.

While:
PHP Code:

while($row=='no')
{
    
//do stuff
    
if($endConditionMet) { $row 'yes'; }



delayedinsanity 12-15-2009 04:55 PM

Quote:

Originally Posted by russellharrower (Post 29504)
I have googled, binged and yahooed...

You have no idea how often PHP has driven me to drinking too...

Village Idiot 12-15-2009 05:26 PM

If you want it to repeat if row is NO, then I assume you will want to do it once no matter what. This would be a job for do while.
PHP Code:

do
{
    
//do stuff
    
if($endConditionMet) { $row 'yes'; }
} while(
$row=='no'



All times are GMT. The time now is 12:23 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0