Re: Waiting for localhost

From: Date: Thu, 02 Apr 2015 03:35:11 +0000
Subject: Re: Waiting for localhost
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  Groups: php.db 
Request: Send a blank email to php-db+get-48996@lists.php.net to get a copy of this message
On 04/01/2015 07:34 AM, Richard wrote:
------------ Original Message ------------
Date: Wednesday, April 01, 2015 00:05:29 -0400 From: Ethan Rosenberg <erosenberg@hygeiabiomedical.com> To: php-db@lists.php.net Richard - As we saw in the Apache list, the problem lies in PHP/MySQL <snip>
Richard - Thanks. The problem is in the database connection. from MySQL mysql> show tables; +-----------------+ | Tables_in_Store | +-----------------+
| Charges         |
| Customers       |
| Food            |
| Inventory       |
| Orders          |
| Purchases       |
+-----------------+ This code works... $hostname="localhost"; $database="Store"; $username="ethan"; $password="xxxxx"; $link = mysqli_connect($hostname, $username, $password); if (!$link) { die('Connection failed: ' . mysql_error()); } else{
     echo "Connection to MySQL server " .$hostname . " successful!
" . PHP_EOL; } $db_selected = mysqli_select_db($link, $database); if (!$db_selected) {
    die ('Can\'t select database: ' . mysql_error());
} else {
    echo 'Database ' . $database . ' successfully selected!';
} $sql1 = "show tables"; $result1 = mysqli_query($link, $sql1); $row1 = mysqli_fetch_array($result1); echo 'row1<br />'; print_r($row1); BUT The output is .... Connection to MySQL server localhost successful! Database Store successfully selected! row1 Array ( [0] => Charges [Tables_in_Store] => Charges ) What am I missing?? TIA Ethan

« previous php.db (#48996) next »