vijay Posted December 22, 2006 Share Posted December 22, 2006 Hi.. Is there any way in mysql to get total no. of columns from specific table..?you have to not use: mysql_num_fields($result);want to say any special query... or mysql function..Regards,Vijay Prajapati. Link to comment Share on other sites More sharing options...
reportingsjr Posted December 22, 2006 Share Posted December 22, 2006 well, you could try and do this: <?php$query = mysql_query("SELECT * FROM `table`");while($row = mysql_fetch_assoc($query)){echo count($row)."<br />";}?> That should print the no of columns a bunch of times. Thats as close as I can come.. Link to comment Share on other sites More sharing options...
jesh Posted December 22, 2006 Share Posted December 22, 2006 I believe you can do a SHOW COLUMNS FROM mytable query in MySQL. Here's a link for more information:http://dev.mysql.com/doc/refman/5.0/en/show-columns.html $query = mysql_query("SHOW COLUMNS FROM `table`"); I haven't tested it though. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now