Log in

View Full Version : Resolved mysql and mysqli connect



Deadweight
05-10-2014, 05:34 PM
This may seem extremely weird; however, i have a problem with mysql_connect and mysqli_connect



$host = "localhost";
$username = "";
$password = "";
$database = "bcelements";

//Dies
$con = mysqli_connect($host,$username,$password, $database) or die("Couldnt Connect to MYSQL!");

//Doesn't die
$con = mysql_connect($host,$username,$password, $database) or die("Couldnt Connect to MYSQL!");
$con = mysqli_connect($host,$username,$password);


If i use


$con = mysqli_connect($host,$username,$password); //or $con = mysql_connect($host,$username,$password);
$selected = mysql_select_db($database, $con) or die("Crap you died"); //Dies


It still dies. Anyone have an idea of the problem?

Deadweight
05-11-2014, 04:39 PM
Well I fixed the errors. Just letting everyone know this for their personal information:
localhost on php


$host = "127.0.0.1";
$username = "root";
$password = "";
$database = "bcelements";
$con = mysqli_connect($host,$username,$password, $database) or die("Couldnt Connect to MYSQL!");