Jump to content

Pilot Center IF Statement


StartVM

Recommended Posts

Hello,

I am coding a state of the art pilot center that includes custom data to each pilot.

Lets say we have 3 different ranks: First Officer, Captain, Senior Captain

And we have 3 trainers: John D, Jane D, John DA

I am trying to make it so if your rank is First Officer, it will say your trainer is John D. If you rank is Captain your trainer is Jane D. I assume it would be an if statement like

if rank= First Officer

then show John Doe

Obviously I don't know what I am talking about with the code, but I assume it is something like that. Can someone help me out? Thanks!

Link to comment
Share on other sites

  • Members

Off topic starts

First of all you will need to do plenty of if's like that

Second what will happen when current chief pilot leaves your va for any reason.

In my opinion the best solution would be a custom module connected with your database and assigning the trainer or manual to the pilot or automaticly

/off topic end

Here is your answer

If(Auth::$userinfo->rank == "rank code" )
{
Echo the name ;
}
ElseIf(Auth::$userinfo->rank == "rank code2" )
{
Echo second name ;
}
And etc do not forget in order to avoid any errors
Else
{
Echo "no trainer found" ;
}

Of topic lesson 1time the = might work but this means you are assigning data to a variable

Twice the == means if something is like something

Link to comment
Share on other sites

This did not work. I got errors left and right when I tried it like this. http://pastebin.com/cW8egRkR

Can you please create a pastebin to get me started.

Here are the two ranks

Regional First Officer (Rank ID= 1) (Echo Malachi Oie)

Senior First Officer (Rank ID= 2) (Echo Bobby Mattox)

It'd be most useful for you to provide: 1. how you've adapted the code (rather than just putting the code given on pastebin) and 2. the errors you're getting

Link to comment
Share on other sites

Off topic starts

First of all you will need to do plenty of if's like that

Second what will happen when current chief pilot leaves your va for any reason.

In my opinion the best solution would be a custom module connected with your database and assigning the trainer or manual to the pilot or automaticly

/off topic end

Here is your answer

If(Auth::$userinfo->rank == "rank code" )
{
Echo the name ;
}
ElseIf(Auth::$userinfo->rank == "rank code2" )
{
Echo second name ;
}
And etc do not forget in order to avoid any errors
Else
{
Echo "no trainer found" ;
}

Of topic lesson 1time the = might work but this means you are assigning data to a variable

Twice the == means if something is like something

You mentioned what would happen if the current Chief Pilot left the VA? I am my own webmaster so in 30 seconds I can easily change 2-3 words in the code and have it fixed! Its is an easy change so paying $50 roughly for that type of module or even $10 would be unessesary :)

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...