Re: last record

From: Date: Tue, 25 Jan 2005 03:56:57 +0000
Subject: Re: last record
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-38311@lists.php.net to get a copy of this message
Thanks Peter The reason I was wanting to do it in php was because the sql query is quite complex and variable depending on the input from a form. When the result page is presented I want to provide a link to the last record at the top of the page. After connecting and selecting the table I am constructing the query I then want pick off the last record and then get all the records the rather cludgy way I am doing it is this: First run $result = mysql_query($sqlstr." desc limit 0,1"); $row = mysql_fetch_assoc($result); Second run $result = mysql_query($sqlstr); while ($row = mysql_fetch_assoc($result)) { This is fine while there is only one order by appended to the query but if there is none or more than one it doesn't work so well Thanks Neil

« previous php.db (#38311) next »