Re: Help with If else if
Tamara Temple <[email protected]>
| Newsgroups | gmane.comp.php.database |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 13 Mar 2012 17:33:43 +0530, Gu®u <[email protected]> sent: > Hi, > > Please help me with this code. I have 2 different fields in mysql table. > What I want is if the field is empty don't show the image. Please look at > the code below. > > > <?php > > > if($search->plugin->ListViewValue()=="") > { > > echo '<a href="'.$search->facebook->ListViewValue().'"><img > src="images/facebook.gif" width="22" height="23"/></a></a>'; > } > if($search->facebook->ListViewValue()=="") > { > > echo '<a href="'.$search->plugin->ListViewValue().'"><img > src="images/twitter.gif" width="22" height="23"/></a></a>'; > } > > > else if($search->plugin->ListViewValue()=="" && > $search->facebook->ListViewValue()=="") > { > > echo ""; > } > > else > { > > echo '<a href="'.$search->plugin->ListViewValue().'"><img > src="images/twitter.gif" width="22" height="23"/></a></a>'.'<a > href="'.$search->facebook->ListViewValue().'"><img > src="images/facebook.gif" width="22" height="23"/></a></a>'; > > } > > > ?> > > > -- > *Best, > * > *Gu®u* > I think we really need to see a lot more than this before we can help. What is the output that is generated? What is $search and how is it set prior to entering this bit of code? As it stands, I can see no reference to MySQL tables in this, nor any idea what values you're expecting and not seeing. If you don't already, please set error_reporting to the most detailed, and turn on display_errors in your output. Before each of the if's echo a var_dump of the values you're testing so we can see their exact values. -- Tamara Temple aka tamouse__ May you never see a stranger's face in the mirror -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php