Jump to content


Photo

T_VARIABLE error


  • Please log in to reply
4 replies to this topic

#1 tubs2222

tubs2222
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 12 March 2006 - 09:25 PM

Hello everyone at Php Freaks

I'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 9

what i'm trying to do is print out $user1 and $user 2

Thanks for reading and if you have any further question regarding my program then ask away.



#2 High_-_Tek

High_-_Tek
  • Members
  • PipPipPip
  • Advanced Member
  • 72 posts

Posted 12 March 2006 - 09:29 PM

$tempuser = $user$a;

TO

$tempuser = $user . $a;


#3 tubs2222

tubs2222
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 12 March 2006 - 09:45 PM

Hey HighTek,

Thanks for replying

I did what you said and now it outputs 12

#4 hitman6003

hitman6003
  • Members
  • PipPipPip
  • Advanced Member
  • 1,807 posts

Posted 12 March 2006 - 10:43 PM

I think:

$tempuser = ${"user$a"};

will work.

#5 tubs2222

tubs2222
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 12 March 2006 - 10:51 PM

[!--quoteo(post=354333:date=Mar 12 2006, 05:43 PM:name=hitman6003)--][div class=\'quotetop\']QUOTE(hitman6003 @ Mar 12 2006, 05:43 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
I think:

$tempuser = ${"user$a"};

will work.
[/quote]

Yes it worked! :) Thank You




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users