4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 Variable
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
Kdawg
Senior WebHelper
Senior WebHelper


Joined: 21 Apr 2003
Posts: 153

PostPosted: Sun May 18, 2003 6:19 am (14 years, 5 months ago) Reply with QuoteBack to Top

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.
OfflineView User's ProfileFind all posts by KdawgSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Sun May 18, 2003 7:52 am (14 years, 5 months ago) Reply with QuoteBack to Top

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
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Darren
Team Member



Joined: 05 Feb 2002
Posts: 549
Location: London

PostPosted: Sun May 18, 2003 8:39 am (14 years, 5 months ago) Reply with QuoteBack to Top

if I've understood what your trying to do this might work:

${$i."wl"} = 10
OfflineView User's ProfileFind all posts by DarrenSend Personal MessageVisit Poster's Website
Kdawg
Senior WebHelper
Senior WebHelper


Joined: 21 Apr 2003
Posts: 153

PostPosted: Sun May 18, 2003 5:34 pm (14 years, 5 months ago) Reply with QuoteBack to Top

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;
}
OfflineView User's ProfileFind all posts by KdawgSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




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.064815 seconds :: 17 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme