[PHP / MySQL] Opmaak mysql_stat()

Pagina: 1
Acties:

Onderwerpen


Acties:
  • 0 Henk 'm!

  • hbokh
  • Registratie: Februari 2002
  • Laatst online: 16-12-2024

hbokh

Unox: the worst OS!

Topicstarter
Bij mij is niet erg veel PHP-kennis aanwezig, maar ik ben vanavond aardig ver gekomen met wat gescheur-en-pleur ;)

Graag zou ik deze "mysqlinfo()" --> http://bok.xs4all.nl/mysqlinfo.php (PHP-source: http://bok.xs4all.nl/mysqlinfo.phps)
er uit willen hebben zien zoals hier --> http://www.hostingidea.com/library/mysqlinfo.php

Vooral het opdelen van mysql_stat() in "hapklare brokken" in de tabel lukt me maar niet...
Is dit nou een PHP-iets (ik denk aan grep / cut / awk)?

This is my sick nature.


Acties:
  • 0 Henk 'm!

  • NMe
  • Registratie: Februari 2004
  • Laatst online: 09-09 13:58

NMe

Quia Ego Sic Dico.

Wat is je plan nou? Wil je dezelfde velden weergeven als in die laatste link die je geeft? * NMe snapt het niet echt.

'E's fighting in there!' he stuttered, grabbing the captain's arm.
'All by himself?' said the captain.
'No, with everyone!' shouted Nobby, hopping from one foot to the other.


Acties:
  • 0 Henk 'm!

  • Glabbeek
  • Registratie: Februari 2001
  • Laatst online: 18-09 07:52

Glabbeek

Dat dus.

Wat is het verschil in layout tussen de twee links die je geeft?

edit:

O ik zie het al. Het gaat om de 'stats' als de uptime enzo. Ik denk dat het gewoon het verschil in versie is waardoor de layout anders is.

[ Voor 55% gewijzigd door Glabbeek op 16-03-2005 00:08 ]

En zo is het maar net.


Acties:
  • 0 Henk 'm!

  • hbokh
  • Registratie: Februari 2002
  • Laatst online: 16-12-2024

hbokh

Unox: the worst OS!

Topicstarter
Voor de duidelijkheid:

In MIJN versie is het mysql_stat()-gedeelte een geheel van 8 stats in een tabel-rij, in de versie van Hostingidea zijn 5 van deze stats opgedeeld in 5 nieuwe rijen. DAT wil ik ook bewerkstellen..
'k Dacht dat dat dat vrij duidelijk te onderscheiden was 8)7

This is my sick nature.


Acties:
  • 0 Henk 'm!

  • Michali
  • Registratie: Juli 2002
  • Laatst online: 29-05 22:54
PHP:
1
2
3
4
5
6
7
8
9
10
11
12
echo '<table>';
$stat = explode('  ', mysql_stat());
foreach ( $stat as $item )
{
  $item = explode(': ', $item);
  echo '<tr><th>',
    $item[0],
    '</th><td>',
    $item[1],
    '</td></tr>';
}
echo '</table>';

Bedoel je zoiets?

Noushka's Magnificent Dream | Unity


Acties:
  • 0 Henk 'm!

  • hbokh
  • Registratie: Februari 2002
  • Laatst online: 16-12-2024

hbokh

Unox: the worst OS!

Topicstarter
Inderdaad, bedankt! Dat komt heel dicht in de buurt. Opgedeeld in rijen. Nu nog de be- / omschrijving ervoor zien te krijgen. :)

This is my sick nature.


Acties:
  • 0 Henk 'm!

  • Michali
  • Registratie: Juli 2002
  • Laatst online: 29-05 22:54
Dat hoort in $item[0] te staan. Doe eens een var_dump op $item. Ik ben wel benieuwd wat daar in zit dan.

Noushka's Magnificent Dream | Unity


Acties:
  • 0 Henk 'm!

  • hbokh
  • Registratie: Februari 2002
  • Laatst online: 16-12-2024

hbokh

Unox: the worst OS!

Topicstarter
var_dump juist ingevoegd in regel 7 hier?

PHP:
1
2
3
4
5
6
7
8
9
10
11
12
13
echo '<table>';
$stat = explode('  ', mysql_stat());
foreach ( $stat as $item )
{
  $item = explode(': ', $item);
  echo '<tr><th>',
    var_dump($item),
    $item[0],
    '</th><td>',
    $item[1],
    '</td></tr>';
}
echo '</table>';

Dit geeft
code:
1
2
3
4
5
6
7
8
array(2) { [0]=>  string(6) "Uptime" [1]=>  string(5) "67483" } Uptime  67483
array(2) { [0]=> string(7) "Threads" [1]=> string(1) "1" } Threads  1
array(2) { [0]=> string(9) "Questions" [1]=> string(5) "51860" } Questions  51860
array(2) { [0]=> string(12) "Slow queries" [1]=> string(1) "0" } Slow queries   0
array(2) { [0]=> string(5) "Opens" [1]=> string(3) "964" } Opens    964
array(2) { [0]=> string(12) "Flush tables" [1]=> string(1) "1" } Flush tables   1
array(2) { [0]=> string(11) "Open tables" [1]=> string(2) "47" } Open tables    47
array(2) { [0]=> string(22) "Queries per second avg" [1]=> string(5) "0.768" } Queries per second avg   0.768

[ Voor 22% gewijzigd door hbokh op 16-03-2005 13:13 ]

This is my sick nature.


Acties:
  • 0 Henk 'm!

  • Michali
  • Registratie: Juli 2002
  • Laatst online: 29-05 22:54
Dat lijkt wel te kloppen. Zou je het resultaat zonder die var_dump (dus de complete table) eens neer kunnen zetten. Mischien dat ik nu iets over het hoofd zie.

Noushka's Magnificent Dream | Unity


Acties:
  • 0 Henk 'm!

  • hbokh
  • Registratie: Februari 2002
  • Laatst online: 16-12-2024

hbokh

Unox: the worst OS!

Topicstarter
Nee, nee, je hebt me ENORM op weg geholpen _/-\o_ en ik ben zeer tevreden met het resultaat!

Check http://bok.xs4all.nl/mysqlinfo.php (PHP-source: http://bok.xs4all.nl/mysqlinfo.phps)

This is my sick nature.

Pagina: 1