Guest User

Untitled

a guest
May 16th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <?php
  2. $dbname = 'name';
  3. $dbuser = 'user';
  4. $dbpass = 'pass';
  5. $dbhost = 'host';
  6. $connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
  7. mysql_select_db($dbname) or die("Could not open the db '$dbname'");
  8. $test_query = "SHOW TABLES FROM $dbname";
  9. $result = mysql_query($test_query);
  10. $tblCnt = 0;
  11. while($tbl = mysql_fetch_array($result)) {
  12. $tblCnt++;
  13. echo $tbl[0]."<br />\n";
  14. }
  15. if (!$tblCnt) {
  16. echo "There are no tables<br />\n";
  17. } else {
  18. echo "There are $tblCnt tables<br />\n";
  19. }
Add Comment
Please, Sign In to add comment