Guest Posted October 9, 2011 Report Share Posted October 9, 2011 Hello guys, I am trying to make a random cargo generator for each specific aircraft to show in schedule briefing, here's what I'm trying to do: <php $ MD11 = rand (50000, 77110); $ 727 = rand (10000, 23000); $ 757 = rand (25000, 47600); if ($ schedule-> aircraft = 'MD-11F') { echo "cargo on board". $ MD11; } elseif ($ schedule-> aircraft = 'B727-200F') { echo "cargo on board". $ 727; } elseif ($ schedule-> aircraft = 'B757-200F') { echo "cargo on board". $ 757; } ?> but it's happening the following error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in E: \ home \ Can someone help me or tell me how to fix this error? (Sorry for the bad english) Thanks ! Quote Link to comment Share on other sites More sharing options...
Guest lorathon Posted October 9, 2011 Report Share Posted October 9, 2011 Try this <php $MD11 = rand(50000, 77110); $727 = rand(10000, 23000); $757 = rand(25000, 47600); if($schedule->aircraft == 'MD-11F') { echo 'cargo on board '.$MD11; } elseif($schedule->aircraft == 'B727-200F') { echo 'cargo on board '.$727; } elseif($schedule-> aircraft == 'B757-200F') { echo 'cargo on board '.$757; } ?> Quote Link to comment Share on other sites More sharing options...
Guest Posted October 9, 2011 Report Share Posted October 9, 2011 Try this <php $MD11 = rand(50000, 77110); $727 = rand(10000, 23000); $757 = rand(25000, 47600); if($schedule->aircraft == 'MD-11F') { echo 'cargo on board '.$MD11; } elseif($schedule->aircraft == 'B727-200F') { echo 'cargo on board '.$727; } elseif($schedule-> aircraft == 'B757-200F') { echo 'cargo on board '.$757; } ?> Hi lorathon, thanks for the reply! keeps giving error, but now the error is different: image-> http://imageshack.us/photo/my-images/402/81901027.jpg/ Thanks. Quote Link to comment Share on other sites More sharing options...
Administrators Nabeel Posted October 9, 2011 Administrators Report Share Posted October 9, 2011 <php should be <?php Quote Link to comment Share on other sites More sharing options...
Guest Posted October 9, 2011 Report Share Posted October 9, 2011 <php should be <?php Thanks Nabeel, but now the error is: PHP Parse error: syntax error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in E:\home\cravoecane9\vlogvirtual\Web\home\lib\skins\do\carga.tpl on line 3 in line 3 have the code: $727 = rand(10000, 23000); Thanks Quote Link to comment Share on other sites More sharing options...
Strider Posted October 9, 2011 Report Share Posted October 9, 2011 $727 = rand(10000, 23000); Try changing the $727 to $B727 = rand(10000, 23000); Quote Link to comment Share on other sites More sharing options...
Guest Posted October 9, 2011 Report Share Posted October 9, 2011 thanks ! worked perfectly grateful Ruan Victor Quote Link to comment 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.