Meetings every second Tuesday
Last record ID in table to be used as default URL parameter
My recordset rsArtRhetoric calls the URL paramter ID through $_GET['id']. The page is mostly viewed with the ID set in the URL. But how do I set the default when there is no ID set in the URL like if someone bookmarks and comes back to the page or retypes the URL without entering an ID?
I want to go to the last record in the table and retrieve that ID and make that the default. Can anyone help me with the code?
Here is my code:
$colname_rsArtRhetoric = "-1"; <-- THIS IS WHERE I THINK I NEED TO SET THE DEFAULT-->
if (isset($_GET['id'])) {
$colname_rsArtRhetoric = (get_magic_quotes_gpc()) ? $_GET['id'] : addslashes($_GET['id']);
}
mysql_select_db($database_cnnMYSITE, $cnnMYSITE);
$query_rsArtRhetoric = sprintf("SELECT art_rhetoric.*, writer.writer_id, writer.writer_fname, writer.writer_lname FROM art_rhetoric LEFT JOIN writer ON art_rhetoric.writer = writer.writer_id WHERE art_rhetoric.id = %s", GetSQLValueString($colname_rsArtRhetoric, "int"));
$rsArtRhetoric = mysql_query($query_rsArtRhetoric, $cnnRealVail) or die(mysql_error());
$row_rsArtRhetoric = mysql_fetch_assoc($rsArtRhetoric);
$totalRows_rsArtRhetoric = mysql_num_rows($rsArtRhetoric);
I'm using PHP 5, Dreamweaver 8.02, and mySQL (latest)





hello
You are absolutely right !!!