You are here: Re: How do I fetch an array of all field names in a mysql database? « All PHP « IT news, forums, messages
Re: How do I fetch an array of all field names in a mysql database?

Posted by Rich on 05/26/06 20:28

On 25 May 2006 12:48:33 -0700, guttyguppy@gmail.com wrote...
>
>Thanks for the lead-the manual is so huge and tough to read that I gave
>up the first time, but now I think I've got it:
>
>$query="SELECT * FROM my_table";
>$result=mysql_query($query);
>$i = 0;
>while ($i < mysql_num_fields($result)) {
> $meta = mysql_fetch_field($result, $i);
> echo $meta->name."</br>\n";
> $i++;
>}
>
>Is that good, non-depracated code though?
>

The link he gave you points to a deprecated function, but also shows what you
can change that to. Looked like you can do it from the mysql_query() function..

e.g. $result = mysql_query("SHOW COLUMNS FROM sometable");



Rich
--
Unlimited Newsgroup Downloads / $19.95 month
More Details - http://newsguy.com/overview.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация