Re: Help with If else if

From: Date: Sun, 18 Mar 2012 18:14:08 +0000
Subject: Re: Help with If else if
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-48226@lists.php.net to get a copy of this message
On Tue, 13 Mar 2012 17:33:43 +0530, Gu®u <nagendra802000@gmail.com> 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

« previous php.db (#48226) next »