Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //koneksi
- $db = "rand_bioskop";
- $con = new mysqli("localhost", "root", "gundam1981", $db); //mysqli
- //coba bikin database sendiri dan isi table2 terserah kamu. anggap ada 5
- // masukkan view didalamnya anggap ada 2
- // Check connection
- if ($con->connect_errno) {
- echo "Failed to connect to MySQL: " . $mysqli->connect_error;
- }
- /* * **
- buatlah fungsi
- extract semua table (only) dalam database..
- masukkan dalam array $aTable yg isinya hanya 5 (jgn 2)
- * *** */
- $sql = "show full tables FROM `{$db}` where Table_Type != 'VIEW'";
- if ($result = $con->query($sql)) {
- while ($row = $result->fetch_row()) {
- //echo "Table: {$row[0]}\n";
- //===========REPAIR TIDAK DILAKUKAN DISINI
- //repair table using MYISAM Only. tested and work!
- //$sql="REPAIR TABLE $row[0] USE_FRM";
- // $con->query($sql);
- // echo "\nRepair:$row[0]";
- // var_dump($con->query($sql));
- $aTable[] = $row[0];
- }
- } else {
- printf("Errormessage: %s\n", $con->error);
- die;
- }
- //===lakukan proses repair/optimize
- foreach ($aTable as $table) {
- $sql = "OPTIMIZE TABLE `{$table}` ; ";
- $con->query($sql);
- echo "\nRepair:$table"
- . "\n$sql\n";
- var_dump($con->query($sql));
- }
- /*
- Buatlah sesingkat mungkin
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement