|
Author |
Message |
Kdawg
Senior WebHelper
Joined: 21 Apr 2003
Posts: 153
|
Posted:
Sun May 18, 2003 6:19 am (20 years, 10 months ago) |
|
How would I add the number contained in the variable $i to the begining of $wl. Ex: if $i = 1 I want the variable $1wl = 10, if $i = 2 I want the variable $2wl = 10. |
|
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun May 18, 2003 7:52 am (20 years, 10 months ago) |
|
Last time I tried (a few days ago!), I could use the $$ method in that way. So you'll have to settle for:
$wl[$i] (which will give $wl[1] or $wl[2]) |
________________________________
|
|
|
|
Darren
Team Member
Joined: 05 Feb 2002
Posts: 549
Location: London
|
Posted:
Sun May 18, 2003 8:39 am (20 years, 10 months ago) |
|
if I've understood what your trying to do this might work:
${$i."wl"} = 10 |
|
|
|
|
Kdawg
Senior WebHelper
Joined: 21 Apr 2003
Posts: 153
|
Posted:
Sun May 18, 2003 5:34 pm (20 years, 10 months ago) |
|
I cant get it to work right, I was trying to make this code shorter, the WHERE needs to go up to 38 so doing it the way I have it means a lot of code. Can someone find a way to make it so I only need 1 and it will loop it or somthing?
Code: | $result = mysql_query( "SELECT * FROM Game_Standings WHERE id = 1)
or die("SELECT Error: ".mysql_error());
$num=mysql_numrows($result);
$i=1;
while ($i < $num) {
$wl1 = mysql_result($result,$i,"wl");
$sc1 = mysql_result($result,$i,"sc");
++$i;
}
$result = mysql_query( "SELECT * FROM Game_Standings WHERE id = 2)
or die("SELECT Error: ".mysql_error());
$num=mysql_numrows($result);
$i=1;
while ($i < $num) {
$wl2 = mysql_result($result,$i,"wl");
$sc2 = mysql_result($result,$i,"sc");
++$i;
}
$result = mysql_query( "SELECT * FROM Game_Standings WHERE id = 3)
or die("SELECT Error: ".mysql_error());
$num=mysql_numrows($result);
$i=1;
while ($i < $num) {
$wl3 = mysql_result($result,$i,"wl");
$sc3 = mysql_result($result,$i,"sc");
++$i;
}
$result = mysql_query( "SELECT * FROM Game_Standings WHERE id = 4)
or die("SELECT Error: ".mysql_error());
$num=mysql_numrows($result);
$i=1;
while ($i < $num) {
$wl4 = mysql_result($result,$i,"wl");
$sc4 = mysql_result($result,$i,"sc");
++$i;
} |
|
|
|
|
|
|
|
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.217337 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |