Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.