Skip to main content
Inspiring
November 24, 2006
Answered

Display dynamic link only if not null

  • November 24, 2006
  • 2 replies
  • 459 views
I have a page with a repeating recordset, with one dynamic variable called Event that I would like to display as a link only if there is a link entered in the link field. When I use data source and select the link field as my link, it also shows all of the other Event entries, the ones with no data in the link field, as links to the current page. Is there any way I can have the Event show as a link only if the event link field contains data?
This topic has been closed for replies.
Correct answer Newsgroup_User
On Sat, 25 Nov 2006 17:30:13 +0000 (UTC), "kllw"
<webforumsuser@macromedia.com> wrote:

>Thanks, Dave. I'm actually using PHP/MySQL. How can I use the Show if Recordset
>not empty when the field is a part of a larger recordset? It's pulling all
>dates for a schedule, some of which are a special event. I always want the text
>of the special event to show, but make that text a link only if there is a link
>in the link field.

You could have:

<td>
<?php
if ( is_null($row_rsMyRecordset['ev_link']) ) {
echo $row_rsMyRecordset['ev_text'];
} else {
echo "<a href=".$row_rsMy['ev_link'].">".$row_rsMy['ev_text']."</a>";
}
?>
</td>
--
Steve
steve at flyingtigerwebdesign dot com

2 replies

webby7097Author
Inspiring
November 25, 2006
Excellent - that did the trick! Thanks much.

K
Inspiring
November 24, 2006
I think you could do something like this if using asp vbscript,

<% If Not your_recordset_name.EOF Or Not your_recordset_name.BOF Then %>

<%=(your_recordset_name.Fields.Item("your_link_field").Value)%>
<% End If ' end Not your_recordset_name.EOF Or NOT
your_recordset_name.BOF %>
If not try the show region if recordset is not empty server behavior for
your lanuage.
Dave
"kllwca" <webforumsuser@macromedia.com> wrote in message
news:ek5g3m$e4n$1@forums.macromedia.com...
> I have a page with a repeating recordset, with one dynamic variable called
> Event that I would like to display as a link only if there is a link
entered in
> the link field. When I use data source and select the link field as my
link, it
> also shows all of the other Event entries, the ones with no data in the
link
> field, as links to the current page. Is there any way I can have the Event
show
> as a link only if the event link field contains data?
>


webby7097Author
Inspiring
November 25, 2006
Thanks, Dave. I'm actually using PHP/MySQL. How can I use the Show if Recordset not empty when the field is a part of a larger recordset? It's pulling all dates for a schedule, some of which are a special event. I always want the text of the special event to show, but make that text a link only if there is a link in the link field.