Displaying mySQL table structures in PHP

posted by Dotnetindex date: Monday, June 30, 2008 category: PHP
  Featured Story | Printable View | Email It | Comments | Write Comment

You can get information about tables using SHOW TABLE STATUS query. This query gives you a detailed info about all tables in your database. We can loop results:

  • Name
  • Engine
  • Version
  • Row_format
  • Rows
  • Avg_row_length
  • Data_length
  • Max_data_length
  • Index_length
  • Data_free
  • Auto_increment
  • Create_time
  • Update_time
  • Check_time
  • Collation
  • Checksum
  • Create_options
  • Comment

We can re-write this query to find only structure about a tables:

SHOW TABLE STATUS LIKE ’products’ 

If you wish to learn  AutoIndex number, here's the comple code written in PHP: 

     <?php
    $qquery = mysql_query("SHOW TABLE STATUS LIKE 'products'");
    $row = mysql_fetch_assoc($qquery);
    $next_increment = $row[’Auto_increment’];
    echo "Next increment number is " . $row["Auto_increment"];
    ?>

 


Custom Search



Gazatem Technologies Active News Manager


page counter

Listed with 411asp.net
Listed with 4aspin.com
PHP, ASP, .NET, JSP Resources, Reviews