#1 (permalink)  
Old 10-07-2008, 02:52 AM
Registered User
 
Join Date: Jul 2004
Posts: 247
php how to print field names into an array

how do you print field names of a db table into an array?
__________________
Gilgal's website:
Wheel Of God
Now easy to post scripture verses!
Portfolio
Reply With Quote

  #2 (permalink)  
Old 10-07-2008, 07:22 AM
curtiss's Avatar
Moderator
 
Join Date: May 2003
Posts: 1,438
You have two choices.

If you are going to be using these field names in conjunction with a regular recordset, you can always use a normal select statement (SELECT * FROM...) and use the mysql_fetch_assoc function to return an associative array of the field names and recordset. Then, just use array_keys to grab the field names out of the associative array that was returned.

Alternatively, you can use DESC [tablename] to show the properties of the table. Then, loop through the recordset that's returned from that and grab all of the array items with the key of "field".
__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
print column names gilgalbiblewhee Programming and Scripting 2 11-19-2008 09:54 AM
php call a function in array() gilgalbiblewhee Programming and Scripting 0 07-06-2008 01:43 PM
array and split warning in php gilgalbiblewhee Programming and Scripting 2 11-07-2007 02:19 PM
Replacing a field separator during a read. NevadaSam Programming and Scripting 2 04-29-2006 02:53 PM
strip carriage returns & linefeed characters from form field amanxman Programming and Scripting 2 03-30-2006 07:52 AM


All times are GMT -5. The time now is 03:16 AM.

 
Bitrix
Clicky Web Analytics
CloudContacts
Maxtango


Subscribe to our feed | add to myYahoo!

Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
© 1997-2007 HTMLCenter