Hi Guys,
I am trying to display logos on my page but some of the records do not have logos and this has placed a "0" in my db.
I have tried using this but with no luck
<?php
$nothing = "0";
{
if ($logo == $nothing){
$logo = "nopic.jpg";
} else {
$logo = $logo;
}
} ?>
Does anyone know how to achieve this?
Thanks
if $logo == "0" do this
Moderator: General Moderators
- jayshields
- DevNet Resident
- Posts: 1912
- Joined: Mon Aug 22, 2005 12:11 pm
- Location: Leeds/Manchester, England
youve got the right idea but try setting $nothing to 0 like this...
instead of
because the way you are doing it now it is looking for a string - atleast i think that is the problem, worth a try anyway.
Code: Select all
$nothing = 0;Code: Select all
$nothing = "0";- harrisonad
- Forum Contributor
- Posts: 288
- Joined: Fri Oct 15, 2004 4:58 am
- Location: Philippines
- Contact:
whenever $logo has a value of false or 0, you can simplify your condition to this
Code: Select all
if($logo){
// or the reverse
if(!$logo){