Jump to content

Simple If Something > Nothing question,


ben03

Recommended Posts

Hi all, New to php. have a question but didn't know how to write in in google to get answer so hopefully someone can make sense of it here! This is the code blow. The title is being bought in but basically want a line of text to be bought in if the entry is blank. Getting an error with the following:

<p class="feed-title"><?php echo $item['TITLE']; ?></p>		    <?php if ($item['TITLE']; = "") {    echo "More great offers and topics can be found on our Facebook page. Click below for more";    }    ?>

Hopefully someone can make sense of this. I am currently fumbling. Thanks

Link to comment
Share on other sites

Yours:

if ($item['TITLE']; = "")

Corrected:

if ($item['TITLE'] == "")

Note that this still might throw a warning (not an error) if $item['TITLE'] has never been set in the first place. If that's possible, this would work:

if (empty($item['TITLE']) )

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...