Re: Finding column names..
| From: | Zak Greant | Date: | Fri, 23 Jun 2000 15:05:18 +0000 |
| Subject: | Re: Finding column names.. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-2806@lists.php.net to get a copy of this message | ||
At 10:46 AM 6/23/00 -0400, Chad Day wrote:
How can I find the column name of the last column in a table? I've been fooling around with mysql_list_fields and stuff, but am not sure how to get the value of the last column. Can anyone help? Thanks, Chad Day Beach AssociatesHi Chad, You could make a describe table query, use mysql_num_rows to find out how many results were returned, and then use mysql result to get the field name. To get a better understanding of the query, check your MySQL manual. i.e. $qh = mysql_query ('describe table_name'); $last_row = mysql_num_rows ($qh) -1; print mysql_result ($qh, $last_row, 'Field'); HTH, Zak Greant Creative Director Nucleus Information Service Inc.