Forum Moderators: coopster

Message Too Old, No Replies

unexpected T_IF error

         

catch2948

2:18 pm on Dec 20, 2003 (gmt 0)

10+ Year Member



I have looked through several posts, but as of yet, I cannot find an answer to my particular problem, which is as follows:

I have written a small bit of code that generates a random number, based on a test of another random number. Code is as follows:

$x = mt_rand(1,10)
if ($x == 5) {
$xb = mt_rand(1,5);
}
else {
$xb = 0;
}

However, everytime the script is executed, if returns the following error: Parse error: parse error, unexpected T_IF

I have tried several variations of this code, but no matter how I change it, it still keeps returning that same error.

Can anyone please help?

Thanks in advance for your replies :-)

phpologist

2:31 pm on Dec 20, 2003 (gmt 0)

10+ Year Member



you're missing a semi-colon after the first line :)

catch2948

9:10 am on Dec 21, 2003 (gmt 0)

10+ Year Member



Shazbot!

It's always the simple stuff that gets ya :-/

Thanks