FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Multirun





DanielXP
How can i make a code run X amount of times?

Its PHP i want it so people can like buy x amount of lotto tickets

got all the code but have no clue how to do it.

Thanks
garionw
a forwhile loop?
DanielXP
I dunno its like

for each

then you add 1 onto the old number and if the numbers bigger it stops if not runs again
asiddle423
it will be something similar to below.
NB its not tested so you might need to tweak it a bit

Code:
//set amount of tickets
//change this to equal what ever sets the amount of tickets
xAmountOfTickets = $_POST['ticketAmount'];
//start x at 0, if it adds 1 too many change the value to 1
x = 0;

while (x < xAmountOfTickets)
{
        x = x+1;
        //code to go in loop goes here
}
DanielXP
Cheers mate
Related topics
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.