marksie1988 Posted July 12, 2007 Share Posted July 12, 2007 Hi, i have written some code that i want to display an image but only if a field in my sql has information in it i currently have: if($req_user_info['Skype'] > 0){ /* Skype */ echo "<a href='callto://".$req_user_info['Skype'] ."'><img src='../images/icons/skype.gif' border='0'/></a>"; } elseif($req_user_info['myspace'] > 0){ /* myspace */ echo "<a href='http://".$req_user_info['myspace'] ."'><img src='../images/icons/myspace.gif' border='0'/></a>";} else{echo "No Extras";} i think that the problem is if($req_user_info['myspace'] > 0){ ^^^ should i be saying is greater than 0 or not? im new to this so please help. Link to comment https://forums.phpfreaks.com/topic/59679-solved-php-if-statement-help/ Share on other sites More sharing options...
cmgmyr Posted July 12, 2007 Share Posted July 12, 2007 you could try isset() if(isset($req_user_info['Skype'])){ ... } Link to comment https://forums.phpfreaks.com/topic/59679-solved-php-if-statement-help/#findComment-296628 Share on other sites More sharing options...
marksie1988 Posted July 12, 2007 Author Share Posted July 12, 2007 OMG i cant belive i didnt notice that sometimes i wonder what my mind is doing to me i totaly disreguarded the isset command Cheers Link to comment https://forums.phpfreaks.com/topic/59679-solved-php-if-statement-help/#findComment-296633 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.