Advertisement
Guest User

Untitled

a guest
Aug 5th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.64 KB | None | 0 0
  1. <?php
  2. # Fill our vars and run on cli
  3. # $ php -f db-connect-test.php
  4. $dbname = 'u562006111_xxx';
  5. $dbuser = 'u562006111_xxx';
  6. $dbpass = 'SipLzbP698BseeJV';
  7. $dbhost = 'sql164.main-hosting.eu';
  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. while($tbl = mysql_fetch_array($result)) {
  14.   $tblCnt++;
  15.   #echo $tbl[0]."<br />\n";
  16. }
  17. if (!$tblCnt) {
  18.   echo "There are no tables<br />\n";
  19. } else {
  20.   echo "There are $tblCnt tables<br />\n";
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement