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

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:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 1st, 2003, 10:01 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
SHOW status question

i am writing some functions to show the current status of the database when the user logs in.
I have succesfully built a SHOW TABLE STATUS function which lists the status of all the tables in the database. I also wanted to display the system status and so have written the following:
PHP Code:
 connect_db(ppukdb);
$sql "SHOW status"
$result mysql_query($sql); 
$myrow mysql_fetch_array($result);
$system_summary "System Summary:<p>
<table width=\"100%\" border=\"0\">
  <tr bgcolor=\"#FFFFFF\"> 
    <td>Up time in sec</td>
    <td>$myrow[Uptime] </td>
  </tr>
  <tr bgcolor=\"#FFFFFF\"> 
    <td>Bytes Received </td>
    <td>$myrow[Bytes_received]</td>
  </tr>
  <tr bgcolor=\"#FFFFFF\"> 
    <td height=\"25\">Bytes sent</td>
    <td>$myrow[Bytes_sent]</td>
  </tr>
  <tr bgcolor=\"#FFFFFF\"> 
    <td>Connections</td>
    <td>$myrow[Connections]</td>
  </tr>
  <tr bgcolor=\"#FFFFFF\"> 
    <td>Aborted connects</td>
    <td>$myrow[Aborted_connects]</td>
  </tr>
  <tr bgcolor=\"#FFFFFF\"> 
    <td>Aborted Clients</td>
    <td>$myrow[Aborted_Clients]</td>
  </tr>
  <tr bgcolor=\"#FFFFFF\"> 
    <td>Max used connections</td>
    <td>$myrow[Max_used_connections]</td>
  </tr>
  <tr bgcolor=\"#FFFFFF\"> 
    <td>Threads connected</td>
    <td>$myrow[Threads_connected]</td>
  </tr>
  <tr bgcolor=\"#FFFFFF\"> 
    <td>Threads running</td>
    <td>$myrow[Threads_running] </td>
  </tr>
  <tr bgcolor=\"#FFFFFF\"> 
    <td>Threads created</td>
    <td>$myrow[Threads_created]</td>
  </tr>
  <tr bgcolor=\"#FFFFFF\">
    <td>Threads cached</td>
    <td>$myrow[Threads_cached]</td>
  </tr>
</table>"
;

foreach (
$myrow as $key => $value) {
    
$system_summary .= "key:$key - value:$value <br> ";
}
disconnect_db(); 


When i ran this code it ran with no errors but would not echo any of the variables. So i added the foreach loop to see what was going on in the array and it returned this:
key:0 - value:Aborted_clients
key:Variable_name - value:Aborted_clients
key:1 - value:558
key:Value - value:558

I am not sure if i have a problem with my SQL statement or my PHP so sorry if this is in the wrong forum.
If i type SHOW status into PHPMYadmin in returns the results fine.

anyone got any ideas?

Once i am finished i'll post them up

thanks

toby

Reply With Quote
  #2  
Old July 7th, 2003, 06:38 AM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
This part:
PHP Code:
 $myrow mysql_fetch_array($result);
$system_summary "System Summary:...<p> 
Just needs to be wrapped in a while loop and you should be fine
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesGeneral SQL Development > SHOW status question


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 6 hosted by Hostway