php-general | 2001122
Date: 12/21/01
- Next message: Garth Dahlstrom: "[PHP] Re: Issues with fopen & long file names?"
- Previous message: Andrey Hristov: "[PHP] last row in the table"
- In reply to: Andrey Hristov: "[PHP] last row in the table"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I wrote this because maybe the ordering is more expensive than 2 queries (one one indexed field possibly).
Regards,
Andrey
----- Original Message -----
From: "Andrey Hristov" <ahristov <email protected>>
To: <php-general <email protected>>
Sent: Friday, December 21, 2001 5:18 PM
Subject: [PHP] last row in the table
> Ususally when someone needs to select last row in a table (s)he do:
> select * from some_table order by some_field desc limit 1;
> but there is another possible solution for mysql :
> <?
> mysql_free_result(mysql_query('select <email protected>:=max(member_id) from memberInfo'));
> $res=mysql_query('select * from memberInfo where member_id= <email protected>;');
> $brr=mysql_fetch_array($res);
> mysql_free_result($res);
>
> var_dump($brr);
> ?>
>
> More info here : http://www.mysql.com/doc/V/a/Variables.html
>
> Regards,
> Andrey Hristov
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe <email protected>
> For additional commands, e-mail: php-general-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>
>
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe <email protected> For additional commands, e-mail: php-general-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Garth Dahlstrom: "[PHP] Re: Issues with fopen & long file names?"
- Previous message: Andrey Hristov: "[PHP] last row in the table"
- In reply to: Andrey Hristov: "[PHP] last row in the table"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

