call last row

hi, i'm a newbie to php and sql and am trying to execute the following
script: i want to call the latest entry to a field in a record set.
its a letter, that asks for a signature, and i want to display, on a
diffent page, the latest signature. here's the letter:
http://badmets.com/buckner/

struggling.....
badmets [ Sa, 27 Januar 2007 02:10 ] [ ID #1610236 ]

Re: call last row

On 26 Jan 2007 17:10:17 -0800, "badmets [at] gmail.com" <badmets [at] gmail.com>
wrote:

>hi, i'm a newbie to php and sql and am trying to execute the following
>script: i want to call the latest entry to a field in a record set.
>its a letter, that asks for a signature, and i want to display, on a
>diffent page, the latest signature. here's the letter:
>http://badmets.com/buckner/
>
>struggling.....
OK, split the idea into 2 stages ...

* you want 1 record only, so you'll use a clause like "LIMIT 1" in
your SELECT

* you want the last record first - so select the ORDER BY and use DESC
So, like

SELECT * FROM signatures ORDER BY idsignatures DESC LIMIT 1

Hope that helps
Chris R.
no [ Sa, 27 Januar 2007 02:45 ] [ ID #1610237 ]

Re: call last row

badmets [at] gmail.com wrote:
> hi, i'm a newbie to php and sql and am trying to execute the
> following script: i want to call the latest entry to a field in a
> record set. its a letter, that asks for a signature, and i want to
> display, on a diffent page, the latest signature. here's the letter:
> http://badmets.com/buckner/
>
> struggling.....

Search comp.databases.mysql for the phrase "strawberry query". It'll tell
you how to do exactly what you want. My lates post on it includes a full
explanation of how it works.
Paul Lautman [ Sa, 27 Januar 2007 10:24 ] [ ID #1610239 ]
PHP » alt.php.sql » call last row

Vorheriges Thema: Pg escape functions
Nächstes Thema: newbie SQL questions...