close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Show Region Utility and Last Row of Recordset

Thread began 1/13/2011 9:28 pm by dan361748 | Last modified 1/14/2011 9:54 am by dan361748 | 755 views | 2 replies |

dan361748

Show Region Utility and Last Row of Recordset

Is there a way to use the Show Region Utility to show something only if the last row in a recordset has not been reached?

Basically, I'm trying to create a list of items from a recordset but I don't want my ending ,  to be displayed if the last row has been reached.

My current piece of code in the is this:

<?php do { ?><a href="browse-results.php?type=<?php echo $row_listingoptions['option_id']; ?>"><?php echo $row_listingoptions['option_name']; ?></a>,&nbsp;<?php } while ($row_listingoptions = mysql_fetch_assoc($listingoptions)); ?>

Is there a way to use mysql_num_rows($listingoptions); or something like that in the 'If' box of the Show Region Utility to do this?

Many thanks!

Sign in to reply to this post

Andrew Read

The line from the recordset seletion that has $totalRows_SOMETHING has a count of how many rows are in the recordset. all you would need is a counter that counts up for each record that is displayed and then checks if it is equal to the totalRows - only display the &nbsp; when it is not equal.

I hope that helps. :)

Sign in to reply to this post

dan361748

Thanks - this did it:

<?php
$i = 1;
if ($row_listingoptions = mysql_fetch_assoc($listingoptions)) {
echo '<a href="mypage.php?type=' . $row_listingoptions['option_id'] .'">'. $row_listingoptions['option_name'] .'</a>';
$i++;
while ($row_listingoptions = mysql_fetch_assoc($listingoptions)){
echo ',&nbsp;';
echo '<a href="mypage.php?type=' . $row_listingoptions['option_id'] .'">'. $row_listingoptions['option_name'] .'</a>';
$i++;
} // end while
} // end if
?>

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...