i'm currently on Apache 2.2 using PHP 5.. I am trying to connect to to MySQL on my Apache server and create a database called my_db... and i have the following code:
<?php
$con=mysqli_connect();
// Check connection
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}else{
echo "Connected Successfully!";
}
// Create database
$sql="CREATE DATABASE my_db";
if (mysqli_query($con,$sql)){
echo "Database my_db created successfully";
}else{
echo "Error creating database: " . mysqli_error();
}
?>
However, when the script runs i get the following output:
Connected Successfully!Error creating database:
Please help. It is not an authentication problem since "Connected Successfully!" is printed...
Thankyou in advance!