Jump to content

if else syntax help


xtiancjs

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
Link to comment
https://forums.phpfreaks.com/topic/8063-if-else-syntax-help/
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]
Link to comment
https://forums.phpfreaks.com/topic/8063-if-else-syntax-help/#findComment-29400
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
Link to comment
https://forums.phpfreaks.com/topic/8063-if-else-syntax-help/#findComment-29492
Share on other sites

Archived

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

×
×
  • Create New...

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.