hi,
i am able to connect to the server with the php script i use below, however the script fails at opening the database. on the Cpanel, when i check for errors on database- the message does say there is an error...but when i click on fixing it...it says it's fixed and then click again on checking for errors- and still get the same message that there is an error found in the database ad infinitum.
i am using the standard php script found on github as follow and recommended in here:
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'username_dbname'; //
$dbuser = 'username_user';
$dbpass = 'pass';
$dbhost = 'localhost';
$connect = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
mysqli_select_db($dbname) or die("Could not open the db '$dbname'");
$test_query = "SHOW TABLES FROM $dbname";
$result = mysqli_query($test_query);
$tblCnt = 0;
while($tbl = mysqli_fetch_array($result)) {
$tblCnt++;
#echo $tbl[0]."<br />\n";
}
if (!$tblCnt) {
echo "There are no tables<br />\n";
} else {
echo "There are $tblCnt tables<br />\n";
}
i am able to connect to the server with the php script i use below, however the script fails at opening the database. on the Cpanel, when i check for errors on database- the message does say there is an error...but when i click on fixing it...it says it's fixed and then click again on checking for errors- and still get the same message that there is an error found in the database ad infinitum.
i am using the standard php script found on github as follow and recommended in here:
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'username_dbname'; //
$dbuser = 'username_user';
$dbpass = 'pass';
$dbhost = 'localhost';
$connect = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
mysqli_select_db($dbname) or die("Could not open the db '$dbname'");
$test_query = "SHOW TABLES FROM $dbname";
$result = mysqli_query($test_query);
$tblCnt = 0;
while($tbl = mysqli_fetch_array($result)) {
$tblCnt++;
#echo $tbl[0]."<br />\n";
}
if (!$tblCnt) {
echo "There are no tables<br />\n";
} else {
echo "There are $tblCnt tables<br />\n";
}