koopkoop Posted February 10, 2009 Share Posted February 10, 2009 If I have a table like so: TABLE TestTable ID / Name / Age ------------------- 1 / Greg / 14 2 / Mary / 45 3 / Bob / 16 Is there an SQL statement that'll return the name of each column and it's numeric index in the table (Eg Id=0,Name=1,age=3)? I know I can do a SELECT *.....then use MYSQL_FETCH_ARRAY to grab the associated numbers, but I was hoping for a more elegant solution. Link to comment https://forums.phpfreaks.com/topic/144677-how-to-get-the-numeric-index-of-columns-in-a-table/ Share on other sites More sharing options...
gevans Posted February 10, 2009 Share Posted February 10, 2009 SELECT id, name, age FROM your-table is this what you mean? You're always going to have to mysql_fetch_(array|assoc|row)() to get your rows Link to comment https://forums.phpfreaks.com/topic/144677-how-to-get-the-numeric-index-of-columns-in-a-table/#findComment-759164 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.