Re: Help with If else if

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I tried the below code too considering may be the localhost is really dumb
and we need to tell each and every condition. But still its not working  :(


$tweet = $search->plugin->ListViewValue();
             $fb = $search->facebook->ListViewValue();


             if($tweet=="" && $fb=="")
             {

                echo "";

             }
             elseif($fb=="" && $tweet!="")
             {

                 echo '<a href="'.$search->plugin->ListViewValue().'"><img
src="images/twitter.gif" width="22" height="23"/></a></a>';


             }

             elseif($tweet=="" && $fb!="")
             {


                 echo '<a
href="'.$search->facebook->ListViewValue().'"><img
src="images/facebook.gif" width="22" height="23"/></a></a>';

             }

             elseif($fb!="" && $tweet!="")
             {


            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>';

             }



On Tue, Mar 13, 2012 at 9:44 PM, Matijn Woudt <tijnema@xxxxxxxxx> wrote:

> On Tue, Mar 13, 2012 at 4:53 PM, Gu®u <nagendra802000@xxxxxxxxx> wrote:
> > No Michael, your code is also not working. What you have understood is
> > correct. let me explain it to others too.
> >
> > If variable twitter and facebook are empty don't echo anything,
> >
> > if variable twitter has a value and facebook is empty echo out only
> twitter,
> >
> > if variable twitter has no value and facebook has a value echo out
> facebook
> > only,
> >
> > and finally if both has values echo out both.
> >
> > Basically I want to echo out only if there is some value in the database.
> > But in my case both the images are echoing out.
> >
>
> That's exactly what my code does too, except it's a bit simpler. If
> mine isn't working too, then your input is probably different, try a
> var_dump on the ListViewValue() items.
>
> - Matijn
>



-- 
*Best,
*
*Gu®u*

[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux