Re: [PHP] How to obtain all the fields' names of a MySQL table?

2001-09-25 Thread Alex Shi
Thanks for all reply! I just realized that this is just a simple issue of a sql query. Alex - Original Message - From: "Alex Shi" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, September 25, 2001 3:03 PM Subject: [PHP] How to obtain all the fields' names of a MySQL table?

RE: [PHP] How to obtain all the fields' names of a MySQL table?

2001-09-25 Thread Adam Plocher
How about this... $db = "name_of_database"; $query = "DESCRIBE table_name"; $query = mysql_db_query($db,$query); while ($row = mysql_fetch_row($query)) { echo "$row[0]\n"; } -Original Message- From: Alex Shi [mailto:[EMAIL PROTECTED]] Sent: Tuesday, September 25, 2001 12:03 PM

Re: [PHP] How to obtain all the fields' names of a MySQL table?

2001-09-25 Thread Sheridan Saint-Michel
Depending on what exactly you are doing you should probably use http://www.php.net/manual/en/function.mysql-list-fields.php or http://www.php.net/manual/en/function.mysql-fetch-field.php Sheridan Saint-Michel Website Administrator FoxJet, an ITW Company www.foxjet.com - Original Message ---

RE: [PHP] How to obtain all the fields' names of a MySQL table?

2001-09-25 Thread Maxim Maletsky \(PHPBeginner.com\)
Why not to look into source code of PHPLIB? The class db_mysql has a function called metadata (I think) - it does exactly that and much more. You can copy the function only or use the class for all your db manipulations if you wish. Maxim Maletsky PHPBeginner.com -Original Message-