Advertisement
Guest User

jaimeeschido

a guest
Mar 8th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. <?php
  2. # Fill our vars and run on cli
  3. # $ php -f db-connect-test.php
  4. $dbname = 'sistemafact';
  5. $dbuser = 'cibercloud';
  6. $dbpass = 'demostracion';
  7. $dbhost = 'sistemafact.cnpazpmtlwsx.us-west-2.rds.amazonaws.com';
  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