tubs2222 Posted March 12, 2006 Share Posted March 12, 2006 Hello everyone at Php FreaksI've been having a problem with a little lottery game of mine that i'm making. Here is the code that receieving a error.<?include "usernames.php";include "numofuserbids.php";for ($a=1; $a <= $i; $a++){$tempuser = $user$a;echo "$tempuser";}In the usernames.php it has in it:<?php $user1 = tubs2222; ?><?php $user2 = abc; ?>and in numofuserbids.php is has in it:<? $i = 2 ?>and finally the error that I recieve is:Parse error: parse error, unexpected T_VARIABLE in /home/www/nationwar.awardspace.com/gamble/testing.php on line 9what i'm trying to do is print out $user1 and $user 2Thanks for reading and if you have any further question regarding my program then ask away. Quote Link to comment https://forums.phpfreaks.com/topic/4786-t_variable-error/ Share on other sites More sharing options...
High_-_Tek Posted March 12, 2006 Share Posted March 12, 2006 [code]$tempuser = $user$a;[/code]TO[code]$tempuser = $user . $a;[/code] Quote Link to comment https://forums.phpfreaks.com/topic/4786-t_variable-error/#findComment-16793 Share on other sites More sharing options...
tubs2222 Posted March 12, 2006 Author Share Posted March 12, 2006 Hey HighTek,Thanks for replyingI did what you said and now it outputs 12 Quote Link to comment https://forums.phpfreaks.com/topic/4786-t_variable-error/#findComment-16798 Share on other sites More sharing options...
hitman6003 Posted March 12, 2006 Share Posted March 12, 2006 I think:[code]$tempuser = ${"user$a"};[/code]will work. Quote Link to comment https://forums.phpfreaks.com/topic/4786-t_variable-error/#findComment-16818 Share on other sites More sharing options...
tubs2222 Posted March 12, 2006 Author Share Posted March 12, 2006 [!--quoteo(post=354333:date=Mar 12 2006, 05:43 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Mar 12 2006, 05:43 PM) [snapback]354333[/snapback][/div][div class=\'quotemain\'][!--quotec--]I think:[code]$tempuser = ${"user$a"};[/code]will work.[/quote]Yes it worked! :) Thank You Quote Link to comment https://forums.phpfreaks.com/topic/4786-t_variable-error/#findComment-16825 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.