nunos Posted August 4, 2009 Share Posted August 4, 2009 I would like to know if it is possible to, trough a php mysql command, get an array with the name of the fields of a table from the database. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/168864-how-to-retrive-field-name-from-database/ Share on other sites More sharing options...
kickstart Posted August 4, 2009 Share Posted August 4, 2009 Hi You can use mysql_ num_ fields() and mysql_ field_ name(). This would give you an array:- $fieldNameArray = array(); for($aCnt = 0;$aCnt<mysql_ num_ fields($rs);$aCnt++) $fieldNameArray[]=mysql_ field_ name($rs,$aCnt); although as you can no doubt see you can get the field names anyway if you know their offset. All the best Keith Quote Link to comment https://forums.phpfreaks.com/topic/168864-how-to-retrive-field-name-from-database/#findComment-890976 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.