ckrudelux Posted February 12, 2009 Share Posted February 12, 2009 <?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 More sharing options...
Wander Posted February 12, 2009 Share Posted February 12, 2009 use == instead of = Link to comment Share on other sites More sharing options...
ckrudelux Posted February 12, 2009 Author Share Posted February 12, 2009 use == instead of =Thanks but thats the difference? Link to comment Share on other sites More sharing options...
jeffman Posted February 12, 2009 Share Posted February 12, 2009 = 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 More sharing options...
jlhaslip Posted February 12, 2009 Share Posted February 12, 2009 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 More sharing options...
ckrudelux Posted February 12, 2009 Author Share Posted February 12, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.