Re: get last field from a table
| From: | JJeffman | Date: | Wed, 10 Jan 2001 20:09:15 +0000 |
| Subject: | Re: get last field from a table | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-5782@lists.php.net to get a copy of this message | ||
If you are using MySQL there are some functions you have to use to complete
the task.
First you must get the fields of the table:
$result= mysql_list_fields("dbname","tablename");
Second, get the number of fields in the query result :
$nFields = mysql_num_fields($result);
And finally get the last field name :
$field = mysql_field_name($result, $nFields -1); // 0 based list;
HTH
Jayme.
http://www.conex.com.br/jjeffman
-----Mensagem Original-----
De: Rubanowicz, Lisa <lisa.rubanowicz@cnh.com>
Para: 'Cahyo S. Aji' <masadjie@students.ee.itb.ac.id>;
<php-db@lists.php.net>
Enviada em: quarta-feira, 10 de janeiro de 2001 09:23
Assunto: RE: [PHP-DB] get last field from a table
> This came from a previous listing hope it helps:
> SELECT MAX(id) FROM permission_table
>
> I am a beginner though so you may want to check for others.
> Lisa
>
> -----Original Message-----
> From: Cahyo S. Aji [mailto:masadjie@students.ee.itb.ac.id]
> Sent: Wednesday, January 10, 2001 10:24 AM
> To: php-db@lists.php.net
> Subject: [PHP-DB] get last field from a table
>
>
>
>
> how can i get the last field from a table?
>
> regards,
> _Ajik_
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>