Advertisement
Super_Roby

Untitled

Apr 19th, 2022
318
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. <?php
  2.  
  3. $dbname = 'database';
  4. $dbuser = 'XXXXXX';
  5. $dbpass = 'XXXXXX';
  6. $dbhost = '192.168.2.133';
  7.  
  8. $link = mysqli_connect($dbhost, $dbuser, $dbpass) or die ("Unable to Connect to '$dbhost'");
  9. mysqli_select_db($link, $dbname) or die("Could not open the db '$dbname'");
  10.  
  11. $test_query = "SHOW TABLES FROM $dbname";
  12. $result = mysqli_query($link, $test_query);
  13.  
  14. $tblCnt = 0;
  15. while($tbl = mysqli_fetch_array($result)) {
  16. $tblCnt++;
  17. #echo $tbl[0]."<br />\n";
  18. }
  19.  
  20. if (!$tblCnt) {
  21. echo "There are no tables<br />\n";
  22. } else {
  23. echo "There are $tblCnt tables<br />\n";
  24. }
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement