Links and echo

Hi we have a site that was developed by somebody who has since left the planet

We have a php code that pulls the link from the database, working fine, the only problem is if there isn’t a link added into the database I want it to show a message “no site added”

I’ve tried all sorts but can’t see something obvious

this is the line <?php echo $rw['ad_link']; ?>Click here

I’m pulling my hair out now, I know I need something like “if empty” but where? Help :slight_smile:

You need to post all your code. Your answer is before this part.

If I’m understanding you correctly, I think this will solve your issue…
Replace:

[php]<?php echo $rw['ad_link']; ?>Click here
[/php]

With:

[php]<?php
if (is_null($row[‘ad_link’]) || $row[‘ad_link’] == “”) {
?> No site added

<?php } else { ?>

<?php echo $rw['ad_link']; ?>Click here"

<?php } ?>[/php]

Like Kevin said, without seeing your code, there might be a better way to do it or code it. The way I coded it you should be able to cut and paste the line you provided.

Sponsor our Newsletter | Privacy Policy | Terms of Service