Jump to content

Random Cargo Generator


Guest

Recommended Posts

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 !

Link to comment
Share on other sites

Guest lorathon

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;
}

?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

<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

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...