refactor db.php

This commit is contained in:
Andreas Zweili 2017-02-05 14:29:42 +01:00
parent 2af63956f6
commit 911ddf848c
1 changed files with 9 additions and 5 deletions

14
db.php
View File

@ -1,10 +1,14 @@
<?php
// Enter your Host, username, password, database below.
// I left password empty because i do not set password on localhost .
$con = mysqli_connect("localhost","webshop","password","webshopdb","3306");
$db_server = 'localhost';
$db_user = 'webshop';
$db_password = 'password';
$db = 'webshopdb';
$db_port = '3306';
$con = mysqli_connect("$db_server","$db_user","$db_password","$db","$db_port");
// Check connection
if (mysqli_connect_errno())
{
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
}
?>