|
Author |
Message |
Kdawg
Senior WebHelper
Joined: 21 Apr 2003
Posts: 153
|
Posted:
Sun Apr 27, 2003 6:13 pm (20 years, 12 months ago) |
|
How would I loop some code to go 30 times? |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun Apr 27, 2003 6:15 pm (20 years, 12 months ago) |
|
What code? I don't understand how this is database related... Do you mean in PHP? |
________________________________
|
|
|
|
Kdawg
Senior WebHelper
Joined: 21 Apr 2003
Posts: 153
|
Posted:
Sun Apr 27, 2003 6:17 pm (20 years, 12 months ago) |
|
Oh yeah sry, PHP loop, I want to run some code 30 times and then stop. |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun Apr 27, 2003 6:20 pm (20 years, 12 months ago) |
|
Code: | $i = 1;
while ($i < 30) {
code_to_run();
$i++;
} |
|
________________________________
|
|
|
|
Kdawg
Senior WebHelper
Joined: 21 Apr 2003
Posts: 153
|
Posted:
Sun Apr 27, 2003 6:34 pm (20 years, 12 months ago) |
|
How would I put this code into the loop
Code: | $sql = "INSERT INTO Gruhn_Stats (ab) VALUES (NULL)";
$result = mysql_query($sql)
or die("Invalid query: " . mysql_error());
$result = mysql_query("SELECT * FROM Robinson_Stats")
or die("Invalid query: " . mysql_error()); |
|
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun Apr 27, 2003 6:36 pm (20 years, 12 months ago) |
|
Code: | $i = 1;
while ($i < 30) {
$sql = "INSERT INTO Gruhn_Stats (ab) VALUES (NULL)";
$result = mysql_query($sql)
or die("Invalid query: " . mysql_error());
$result = mysql_query("SELECT * FROM Robinson_Stats")
or die("Invalid query: " . mysql_error());
$i++;
} |
I guess |
________________________________
|
|
|
|
adam
Forum Moderator & Developer
Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Mon Apr 28, 2003 7:07 pm (20 years, 12 months ago) |
|
Code: |
for ($i = 1; $i < 30, ++$i) {
$sql = "INSERT INTO Gruhn_Stats (ab) VALUES (NULL)";
$result = mysql_query($sql)
or die("Invalid query: " . mysql_error());
$result = mysql_query("SELECT * FROM Robinson_Stats")
or die("Invalid query: " . mysql_error());
} |
would be better than a while loop...though I can't see what use the code is either way. |
________________________________ It's turtles all the way down... |
|
|
|
|
|
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.
|
Page generation time: 0.12498 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |