Re: Help with If else if

Gu®u <[email protected]>
Newsgroups gmane.comp.php.database
Message-ID <CAHmJ=UuJ0uxPaO2JF1tvqyyzNM5ej496eUWL4d6_vqSVi1VVEg@mail.gmail.com>
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 <[email protected]> wrote:

> On Tue, Mar 13, 2012 at 4:53 PM, Gu®u <[email protected]> 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*
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.