abes_nitya Posted September 28, 2006 Share Posted September 28, 2006 hello, i have a problem "how to find the number of columns in a table" .......i mean 'how many columns a table have...?thanks. Link to comment Share on other sites More sharing options...
skym Posted September 28, 2006 Share Posted September 28, 2006 <?php$link = mysql_connect("localhost","***","***");$sql = "SHOW COLUMNS FROM yourdb.yourtable";$result = mysql_query($sql,$link);while ($row = mysql_fetch_assoc($result)) {echo "<pre>";print_r($row);echo "</pre>";}echo "Number of columns: ".mysql_num_rows($result);mysql_close($link);?> http://dev.mysql.com/doc/refman/4.1/en/show-columns.htmlhttp://dev.mysql.com/doc/refman/4.1/en/show.html 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