The Mysqli connections shop folder works great. However I suggest making changes. Add the variable you created $database_shop to last parameter in the $shop connection string. Don't leave it as open quotes! People may not know to add the name of database to last parameter!
<?php ob_start();
# FileName="Connection_php_mysql.htm" # Type="MYSQLi" # HTTP="true" $hostname_shop = " "; $database_shop = "shopping"; $username_shop = " "; $password_shop = " "; $shop = new mysqli($hostname_shop, $username_shop, $password_shop, " ") <---- ADD THE VARIABLE "$database_shop" for last parameter not double quotes in this area or people may get confused ) if ($shop->connect_errno) { echo "Failed to connect to MySQL: (" . $shop->connect_errno . ") " . $shop->connect_error; exit(); } ?> <?php if(!isset($_SESSION)){ session_start(); } ?>
Update demo store connection shop.php to this:
<?php ob_start();
# FileName="Connection_php_mysql.htm" # Type="MYSQLi" # HTTP="true" $hostname_shop = " "; $database_shop = "shopping"; $username_shop = " "; $password_shop = " "; $shop = new mysqli($hostname_shop, $username_shop, $password_shop, $database_shop); if ($shop->connect_errno) { echo "Failed to connect to MySQL: (" . $shop->connect_errno . ") " . $shop->connect_error; exit(); } ?> <?php if(!isset($_SESSION)){ session_start(); } ?>
Jay Hill |
|
|