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