Advertisement
Guest User

Untitled

a guest
Jun 14th, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. <?php
  2. # Fill our vars and run on cli
  3. # $ php -f db-connect-test.php
  4. $dbname = 'dbname';
  5. $dbuser = 'dbuser';
  6. $dbpass = 'dbpass';
  7. $dbhost = 'localhost';
  8. $connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
  9. mysql_select_db($dbname) or die("Could not open the db '$dbname'");
  10. $test_query = "SHOW TABLES FROM $dbname";
  11. $result = mysql_query($test_query);
  12. $tblCnt = 0;
  13. echo 'Ard Mysql DB Tester Ver. 1.0 By Eka'."<br />\n";
  14. echo '===================================='."<br />\n"."<br />\n";
  15. while($tbl = mysql_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 '===================================='."<br />\n"."<br />\n";
  24. echo "There are $tblCnt tables<br />\n";
  25. }
  26.  
  27. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement