
mastermind
Threadstarter
- Dabei seit
- 02.02.2002
- Beiträge
- 286
Hi,
Hier einmal ein kleines Script womit ihr die Datenbank optimieren könnt.
Soo..
Grossen DANK an stpe !!!!
Last edited by mastermind at 25.06.2002, 19:19
Hier einmal ein kleines Script womit ihr die Datenbank optimieren könnt.
Code:
<HTML>
<HEAD>
<TITLE></TITLE>
<style>
body,table{
font-size: 10px;
font-family: Arial;
}
.border{
border-width: 1px;
border-style: solid;
border-color: #000000;
}
tr.header{
background-color: #F8F5B6;
}
</style>
</HEAD>
<BODY>
<?php
$host = "localhost";
$user = "";
$pass = "";
$dbase = "";
$db = mysql_connect($host, $user, $pass) or die ("verbindung fehlgeschlagen");
mysql_select_db($dbase, $db) or die ("verbindung zur datenbank fehlgeschlagen");
$sql = "show tables";
$r_sql = mysql_query($sql,$db);
if($r_sql){
echo "<table cellspacing=\"0\" cellpadding=\"0\" width=\"80%\" align=\"center\" class=\"border\"><tr><td>\n";
echo "<table cellspacing=\"0\" cellpadding=\"2\" width=\"100%\" align=\"center\" >\n";
echo "<tr class=\"header\"><td>Tabelle</td><td>Operation</td><td>Status</td><td>Operation</td><td>Status</td></tr>\n";
while($table = mysql_fetch_row($r_sql)){
$sql_o = "optimize table ".$table[0];
$r_sqlo = mysql_query($sql_o,$db);
$sql_c = "check table ".$table[0]." medium";
$r_sql_c = mysql_query($sql_c,$db);
if($r_sqlo){
$msg_o = mysql_fetch_array($r_sqlo);
$msg_c = mysql_fetch_array($r_sql_c);
if($msg_o['Msg_text'] == "Table is already up to date"){ $color = "#CAF9AE"; }
if($msg_o['Msg_text'] == "OK"){ $color = "#63EB66"; }
if($msg_o['Msg_text'] == "The handler for the table doesn't support check/repair"){ $color = "#F21C1C"; }
echo "<tr bgcolor=\"".$color."\"><td width=\"20%\" nowrap>".$table[0]."</td><td width=\"20%\" nowrap>".$msg_c[Op]."</td><td width=\"20%\" nowrap>".$msg_c[Msg_text]."</td><td width=\"20%\" nowrap>".$msg_o[Op]."</td><td width=\"20%\" nowrap>".$msg_o[Msg_text]."</td></tr>\n";
}
}
echo "</table>\n";
}
?>
</BODY>
</HTML>
Soo..
Grossen DANK an stpe !!!!
Last edited by mastermind at 25.06.2002, 19:19