Need help with an if...else statement
Moderator: General Moderators
Need help with an if...else statement
Thanks for the help on this. New to PHP and this should be a basic question, what I need is:
if ($input1=='logix') and ($input2=='desk')
{
echo "<p>You want $nba1</p>";
}
So if 1 = this and 2 = that, you want 3.
Thanks for the help!
if ($input1=='logix') and ($input2=='desk')
{
echo "<p>You want $nba1</p>";
}
So if 1 = this and 2 = that, you want 3.
Thanks for the help!
Re: Need help with an if...else statement
Code: Select all
if ($input1=='logix' && $input2=='desk')
{
echo "<p>You want $nba1</p>";
}
Re: Need help with an if...else statement
I don't get the question.
Re: Need help with an if...else statement
Thanks, I'll give it a try, seems to be what I'm looking for. THANKS again!panic! wrote:Code: Select all
if ($input1=='logix' && $input2=='desk') { echo "<p>You want $nba1</p>"; }
*EDIT* Just tried it out, does exactly what I wanted, BIG THANKS
Re: Need help with an if...else statement
I am confused. That is the code that was in your original post.
Re: Need help with an if...else statement
dbemowsk wrote:I am confused. That is the code that was in your original post.
Code: Select all
if ($input1=='logix' and $input2=='desk')Code: Select all
if ($input1=='logix') and ($input2=='desk')@Njacobi
AND is a PHP keyword. It is logically the same as && but has different operator precedence:
http://phpbuilder.com/manual/en/languag ... precedence
There are 10 types of people in this world, those who understand binary and those who don't
Re: Need help with an if...else statement
Yeah, originally I put in 'and' just because that's what I wanted it to mean. Didn't think it would actually work. To make it work, all I had to do was get rid of the extra parentheses. Thanks again to everyone who helped. The script is finished and works great.
Re: Need help with an if...else statement
I see that now that I looked closer.
Re: Need help with an if...else statement
's Okay. I can recommend a good ophthalmologist for you.dbemowsk wrote:I see that now that I looked closer.