Jump to content

If Else Statment


ckrudelux
 Share

Recommended Posts

<?phpif ('http://' = $row['image'] or ' ' = $row['image']){echo '';}else {?>	<div>		<img alt="no image" class="article_img" src="<?php echo $row['image'];?>" />	</div>	<div class="headline_p">	</div><?php}?>

So what I want to do is:if http:// = $row['image]orNothing = $row['image]It should do nothingelse write out my html codeGet a Parse error.. 2 resons why: I think I can code php or I don't know

Link to comment
Share on other sites

= is the assignment operator. $x=5 means "Set the contents of $x to 5."== is an equality test. The expression it is in gets evaluated to true or false. So 1==1 returns (gets evaluated to) true; 1==5 returns false. True and false are the only things that if() statements are looking for.Some languages use = for both. This limits the functionality.

Link to comment
Share on other sites

a single "=" is an assignment operator. Assign the value of b to variable a would be

 $a = $b

a double "=" is a comparison operator. Is the value a equal to the var b? would become

 $a == $b

a triple "=" is a comparison operator that checks both the values and the 'type' of the variable. types can be numeric, strings, boolean, etc.

Link to comment
Share on other sites

a single "=" is an assignment operator. Assign the value of b to variable a would be
 $a = $b

a double "=" is a comparison operator. Is the value a equal to the var b? would become

 $a == $b

a triple "=" is a comparison operator that checks both the values and the 'type' of the variable. types can be numeric, strings, boolean, etc.

I keep learning everyday, then I'm not in school :) lol Thanks for the help
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...