TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 09-17-2008, 05:09 AM   #1 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default preventing for loops to repeat in while loops

How do I fix my for loops from repeating in while loops?
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 09-17-2008, 06:15 AM   #2 (permalink)
The Addict
 
tony's Avatar
 
Join Date: Aug 2008
Posts: 336
Thanks: 8
tony is on a distinguished road
Default

do you mean you want to prevent for loops to run inside while loops? an example or the actual code would come in handy to illustrate the problem.
tony is offline  
Reply With Quote
Old 09-17-2008, 06:23 AM   #3 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Quote:
Originally Posted by tony View Post
do you mean you want to prevent for loops to run inside while loops? an example or the actual code would come in handy to illustrate the problem.
I want to prevent for loops from repeating in while loops.
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 09-17-2008, 10:26 AM   #4 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
Salathe is on a distinguished road
Default

If you don't want something to repeat, don't use a loop. I'm really not sure what's being asked here.
Salathe is offline  
Reply With Quote
Old 09-17-2008, 01:20 PM   #5 (permalink)
The Prestige
Advanced Programmer Top Contributor Good Samaritan 
 
sketchMedia's Avatar
 
Join Date: Oct 2007
Location: Manchester, UK
Posts: 854
Thanks: 32
sketchMedia is on a distinguished road
Default

A loop by definition is a block of code which is defined once but executed more than once in succession, hence the term 'loop'.

No idea what you mean, could you clarify if possible?
__________________
mysql> SELECT * FROM `users` WHERE `users`.`clue` > 0;
Empty set (0.00 sec)
sketchMedia is offline  
Reply With Quote
Old 09-17-2008, 04:52 PM   #6 (permalink)
The Contributor
 
buggabill's Avatar
 
Join Date: Jan 2008
Location: Maine, USA
Posts: 92
Thanks: 2
buggabill is on a distinguished road
Default

You could wrap the for loop in an if block...

Without code it is hard to say though.
__________________
-- Bill
"Why is it drug addicts and computer aficionados are both called users?" -Clifford Stoll
buggabill is offline  
Reply With Quote
Old 09-17-2008, 07:35 PM   #7 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

I'm making a calendar system, I haven't found any other way around it. By the way, I never have had to make a calendar system before so. xD
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 09-18-2008, 12:00 PM   #8 (permalink)
The Contributor
 
buggabill's Avatar
 
Join Date: Jan 2008
Location: Maine, USA
Posts: 92
Thanks: 2
buggabill is on a distinguished road
Default

I think what we are looking for is the actual code where the loop resides. Does it look something like this?

php Code:
while (someexpression) {
    for(stuff) {
    ...
    }
}

Do you wish to prevent the for loop from being executed every time through the while and only execute it sometimes?

"Need more input!" - Johnny 5
__________________
-- Bill
"Why is it drug addicts and computer aficionados are both called users?" -Clifford Stoll
buggabill is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 07:09 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design