Jump to content

Archived

This topic is now archived and is closed to further replies.

xtiancjs

if else syntax help

Recommended Posts

Hi , am having a little trouble with the following:

I have a link that contains a url like this:

homepage:<a href="<?php echo $row_bprofile['broker_url']; ?>" target="_blank"> click here</a>

What I want to do is, if there is a value in the db for the url , display the link

if there is no url value just leave the space empty.


i tried <?php $url1 = $row_bprofile['broker_url'];
if($url1 = "not null") { echo 'homepage:<a href="<?php echo $row_bprofile['broker_url']; ?>" target="_blank"> click here</a>' ; }
else {echo ;} ?>

I got lots of errors



any ideas?

xtian

Share this post


Link to post
Share on other sites
Change this:
[code]<?php $url1 = $row_bprofile['broker_url'];
if($url1 = "not null") { echo 'homepage:<a href="<?php echo $row_bprofile['broker_url']; ?>" target="_blank"> click here</a>'; }
else {echo;} ?>[/code]to
[code]<?php

$url1 = $row_bprofile['broker_url'];

if($url1 != "" && strlen($url) >= 6)
{
    echo "homepage: <a href=\"" . $row_bprofile['broker_url'] . "\" target=\"_blank\">click here</a>";
}

?>[/code]

Share this post


Link to post
Share on other sites
[!--quoteo(post=367264:date=Apr 21 2006, 02:30 PM:name=wildteen88)--][div class=\'quotetop\']QUOTE(wildteen88 @ Apr 21 2006, 02:30 PM) [snapback]367264[/snapback][/div][div class=\'quotemain\'][!--quotec--]
Change this:
[code]<?php $url1 = $row_bprofile['broker_url'];
if($url1 = "not null") { echo 'homepage:<a href="<?php echo $row_bprofile['broker_url']; ?>" target="_blank"> click here</a>'; }
else {echo;} ?>[/code]to
[code]<?php

$url1 = $row_bprofile['broker_url'];

if($url1 != "" && strlen($url) >= 6)
{
    echo "homepage: <a href=\"" . $row_bprofile['broker_url'] . "\" target=\"_blank\">click here</a>";
}

?>[/code]
[/quote]

thanks for replying guru, what happenned was the link doesn't show in any situation, will keep trying, if you can think of anything else cool, if not peace

Share this post


Link to post
Share on other sites
Here:
[code]<?php
$url1 = $row_bprofile['broker_url'];
if(!empty($url1)){ ?>
homepage: <a href="<?php echo($url1); ?>" target="_blank"> click here</a><?php } ?>
[/code]

Orio.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.