I have it installed and have created a database and user. Since I can use
QP2TERM to run commands on the DB I assume it's running.
I'm trying to install Wordpress for a POC. I try to connect with this
sample PHP, but it's not working. How can I confirm all of my settings on
the mySql server? Thanks
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'wordpress';
$dbuser = 'myuser';
$dbpass = 'mypassword';
$dbhost = 'localhost';
$connect = mysql_connect($dbhost, $dbuser, $dbpass) or die("Unable to
Connect to '$dbhost'");
mysql_select_db($dbname) or die("Could not open the db '$dbname'");
$test_query = "SHOW TABLES FROM $dbname";
$result = mysql_query($test_query);
$tblCnt = 0;
while($tbl = mysql_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";
}
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact
[javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.