Database can't be fetch. HELP! :(

studio1p

New Member
Messages
1
Reaction score
0
Points
1
<?php
$mysql_hostname = "198.91.81.7";
$mysql_user = "";
$mysql_password = "";
$mysql_database = "shoopingcart";
$prefix = "";
$bd = ($GLOBALS["___mysqli_ston"] = mysqli_connect($mysql_hostname, $mysql_user, $mysql_password)) or die("Could not connect database");
((bool)mysqli_query( $bd, "USE " . $mysql_database)) or die("Could not select database");
?>

<?php
//database connection
try {
$dbc = new PDO('mysql:host=198.91.81.7; dbname=shoopingcart', '', '');
$dbc->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
} catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
?>


What's wrong with my codes?
 

bdistler

Well-Known Member
Prime Account
Messages
3,534
Reaction score
196
Points
63
What's wrong with my codes?

the following settings should be used:
Host/Server Name - [ localhost ]

Port - [ 3306 ] (not necessary)

Username --> Your cPanel username followed by an underscore and the MySQL username you configured in cPanel

Password --> The password that you used when creating the MySQL user

Database --> Your cPanel username followed by an underscore and the name of the database that you created in cPanel
NOTE: Free hosting accounts do not have remote MySQL access.
 
Top