Guest User

show taable only not views

a guest
Jan 9th, 2018
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. <?php
  2. //koneksi
  3. $con= new mysqli("localhost","root","","my_db");//mysqli
  4. //coba bikin database sendiri dan isi table2 terserah kamu. anggap ada 5
  5. // masukkan view didalamnya anggap ada 2
  6. // Check connection
  7. if ($con->connect_errno) {
  8. echo "Failed to connect to MySQL: " . $mysqli->connect_error;
  9. }
  10. //LIST ALL TABLE
  11. $sql= "show full tables FROM my_db where Table_Type != 'VIEW'";
  12. $result = $con->query($sql);
  13. while ($row = $result->fetch_row()) {
  14. echo "Table: {$row[0]}\n";
  15. //repair table using MYISAM Only. tested and work!
  16. $sql="REPAIR TABLE $row[0] USE_FRM";
  17. $con->query($sql);
  18. echo "\nRepair:$row[0]";
  19. var_dump($con->query($sql));
  20. }
  21.  
  22. /****
  23. buatlah fungsi
  24. extract semua table (only) dalam database..
  25. masukkan dalam array $aTable yg isinya hanya 5 (jgn 2)
  26. *****/
  27.  
  28.  
  29. //===lakukan proses repair/optimize
  30.  
  31.  
  32. /*
  33. Buatlah sesingkat mungkin
  34. */
Advertisement
Add Comment
Please, Sign In to add comment