Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Display dynamic link only if not null

Explorer ,
Nov 23, 2006 Nov 23, 2006

Copy link to clipboard

Copied

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?
TOPICS
Server side applications

Views

408
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Nov 25, 2006 Nov 25, 2006
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...

Votes

Translate
LEGEND ,
Nov 24, 2006 Nov 24, 2006

Copy link to clipboard

Copied

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?
>


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 25, 2006 Nov 25, 2006

Copy link to clipboard

Copied

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.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 25, 2006 Nov 25, 2006

Copy link to clipboard

Copied

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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 25, 2006 Nov 25, 2006

Copy link to clipboard

Copied

On Sun, 26 Nov 2006 02:23:24 +0800, Steve <me@here.com> wrote:

>You could have:

Sorry, a typo crept in. I meant to write (where, of course,
$row_rsMyRecordset['event_text'] and $row_rsMyRecordset['event_link']
are whatever your query returns):

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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 25, 2006 Nov 25, 2006

Copy link to clipboard

Copied

LATEST
Excellent - that did the trick! Thanks much.

K

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines