/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function fixTables($conn,$dbname) { // search for all the tables of // a db and run repair and optimize // note: this can take a lot of time // if you have big/many tables. global $conn; if ( $rs = $conn->query("SHOW TABLES FROM $dbname") ) { while ( $r = $rs->fetch_array() ) { $conn->query("REPAIR TABLE {$r[0]}"); $conn->query("OPTIMIZE TABLE {$r[0]}"); } $rs->free(); } }
URL: http://www.barattalo.it/2010/01/29/10-php-usefull-functions-for-mysqli-improved-stuff/