close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

recordset default to last record

Thread began 4/16/2014 9:18 pm by Christopher West | Last modified 4/17/2014 8:20 am by Christopher West | 1060 views | 5 replies

Christopher WestCommunity Expert

Hi Justin, I had already thought of that but it wont work.


here the adjust code with the ORDER BY that you suggested:

$colname_rsBlog = "-1";
if (isset($_GET['BlogID'])) {
$colname_rsBlog = $_GET['BlogID'];
}
mysql_select_db($database_harropsdb, $harropsdb);
$query_rsBlog = sprintf("SELECT * FROM blog WHERE BlogID = %s ORDER BY BlogID DESC", GetSQLValueString($colname_rsBlog, "int"));
$rsBlog = mysql_query($query_rsBlog, $harropsdb) or die(mysql_error());
$row_rsBlog = mysql_fetch_assoc($rsBlog);
$totalRows_rsBlog = mysql_num_rows($rsBlog);



The part I need to figure out it this code in the adove

$colname_rsBlog = "-1";



Since the -1 will return no records if there is not a URL variable being passed in I need to adjust the -1 so that it will return the last record in the database table. (obviously it works if I manually enter in the last record rather than using -1

when the user first goes to that page there would be no URL parameters (our-thoughts.php)

but on this page when the user selects from the right side navigation it will reenter this page with something like "our-thoughts.php?BlogID=15"

I hope this explains my situation further :)

The only way I can think of is to create some php code before creating the recordset and assigning a variable to the last record in the database using something like MAX

and then replacing the -1 in

$colname_rsBlog = "-1";

with something like

$colname_rsBlog = "MyVariableStoringLastRecord";



Chris

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