General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 1st, 2003, 08:17 AM
tobycatlin tobycatlin is offline
Hooner
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: norwich
Posts: 51 tobycatlin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
how can i find out the size of a table

Hi all
i am working on a content managment system using PHP and MySQL and i would like to put a little summary of the status of the database on the log on screen. I have been going through PHP.net looking for a function that will return the size of various tables in bytes. In a very similar way to phpMYadmin does when you click on a table.
anyone know of a function that will do this? or what i would need to do to write one?

thanks all

toby

Reply With Quote
  #2  
Old July 1st, 2003, 08:22 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
I don't know a function right off, but the quickest thing might be for you to take a quick look at the code for PHPMyAdmin and see how they're doing it.

Reply With Quote
  #3  
Old July 1st, 2003, 10:20 AM
tobycatlin tobycatlin is offline
Hooner
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Location: norwich
Posts: 51 tobycatlin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Got it
I needed a SQL statment rather than a PHP function

this seems to do the trick nicely
PHP Code:
 $sql "SHOW TABLE STATUS FROM ppukdb"
$result mysql_query($sql); 
$database_summary 'Database Summary:<p>
<table width="100%" border="0">
  <tr>
    <td>Table name</td>
    <td>Size of table</td>
    <td>No. rows</td>
    <td>Last modified</td>
  </tr>'
;

while (
$myrow mysql_fetch_array($result)) {  
$database_summary .= "  <tr bgcolor=\"#FFFFFF\" class=\"smalltext\">
    <td>$myrow[Name]</td>
    <td>$myrow[Data_length] bytes</td>
    <td>$myrow[Rows]</td>
    <td>$myrow[Update_time]</td>
  </tr>"
;
}
//end of while
$database_summary .= '</table>'


there is more information stored in the array but it isn't really that interesting to me. here is a full list Go to MySQL

bye
toby

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > how can i find out the size of a table


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT