fenway Posted January 26, 2007 Share Posted January 26, 2007 I doubt there is a solution to this problem, but I figured I'd share my frustrations. I know you can run SHOW COLUMNS to get the details of each column in a table, but for some reason, this is "output-only", and can't be used as a proper result set -- and I don't know why. AFAIK, there is no workaround to being able to "extract" such a list of fields in any way.If anyone has a brilliant workaround, I'd be duly impressed. Quote Link to comment Share on other sites More sharing options...
hvle Posted January 26, 2007 Share Posted January 26, 2007 show columns do return a resultset[code]<?php $sql = "show columns from city"; $rs = mysql_query($sql); while ($values = mysql_fetch_assoc($rs)) { print_r($values); }?>[/code]output:[code]Array( [Field] => idn [Type] => int(10) unsigned [Null] => NO [Key] => PRI [Default] => [Extra] => auto_increment)Array( [Field] => name [Type] => varchar(45) [Null] => NO [Key] => [Default] => [Extra] => )Array( [Field] => state [Type] => varchar(45) [Null] => NO [Key] => [Default] => [Extra] => )Array( [Field] => path [Type] => varchar(128) [Null] => NO [Key] => [Default] => [Extra] => )Array( [Field] => link [Type] => varchar(128) [Null] => NO [Key] => [Default] => [Extra] => )[/code]is that what you wanted? it seems to work fine on my machine. Quote Link to comment Share on other sites More sharing options...
fenway Posted January 26, 2007 Author Share Posted January 26, 2007 Thanks, hvle, but I mean a "result set" in the SQL sense -- one that i can JOIN with other tables. Quote Link to comment 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.