|
Author |
Message |
Kdawg
Senior WebHelper
![Senior WebHelper Senior WebHelper](images/rank_3.gif)
![](images/avatars/gallery/computers/php.gif)
Joined: 21 Apr 2003
Posts: 153
|
Posted:
Sun May 18, 2003 6:19 am (21 years, 1 month ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
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. |
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Kdawg Find all posts by Kdawg](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) |
![](images/spacer.gif) |
Daniel
Team Member
![](images/rank_6.gif)
![](http://www.4webhelp.net/forums/images/daniel_avatar.php)
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Sun May 18, 2003 7:52 am (21 years, 1 month ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
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]) |
________________________________
![Image Image](http://www.4webhelp.net/images/daniel_sig.gif) |
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Daniel Find all posts by Daniel](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) |
![](images/spacer.gif) |
Darren
Team Member
![](images/rank_6.gif)
![](images/avatars/gallery/computers/apple.gif)
Joined: 05 Feb 2002
Posts: 549
Location: London
|
Posted:
Sun May 18, 2003 8:39 am (21 years, 1 month ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
if I've understood what your trying to do this might work:
${$i."wl"} = 10 |
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Darren Find all posts by Darren](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) ![Visit Poster's Website Visit Poster's Website](templates/4WebHelp2/images/lang_english/icon_www.gif) |
![](images/spacer.gif) |
Kdawg
Senior WebHelper
![Senior WebHelper Senior WebHelper](images/rank_3.gif)
![](images/avatars/gallery/computers/php.gif)
Joined: 21 Apr 2003
Posts: 153
|
Posted:
Sun May 18, 2003 5:34 pm (21 years, 1 month ago) |
![Reply with Quote Reply with Quote](templates/4WebHelp2/images/lang_english/icon_quote.gif) ![Back to Top Back to Top](templates/4WebHelp2/images/icon_up.gif) |
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;
} |
|
|
|
![Offline](templates/4WebHelp2/images/offline.gif) ![View User's Profile View User's Profile](templates/4WebHelp2/images/lang_english/icon_profile.gif) ![Find all posts by Kdawg Find all posts by Kdawg](templates/4WebHelp2/images/lang_english/icon_search.gif) ![Send Personal Message Send Personal Message](templates/4WebHelp2/images/lang_english/icon_pm.gif) |
![](images/spacer.gif) |
|
|
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.115586 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |