MySQL Forums
Forum List  »  PHP

Problem with database connection on php
Posted by: Andrew James
Date: July 28, 2016 10:43AM

I'm having some problem with database name not connecting. Even though the username,password and hostname works but I don't understand of why the database name is not connected and I even grant the user to all privileges. I've tried several times and nothing works on database name.


<?php
$username = "andrew";
$password = "password";
$hostname = "localhost";

//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";

//select a database to work with
$selected = mysql_select_db("jamesfamilydirectory",$dbhandle)
or die("Could not select examples");

I'm currently using PHP version: 5.6.23 and mysql verison is 5.7.13


?>

Options: ReplyQuote


Subject
Written By
Posted
Problem with database connection on php
July 28, 2016 10:43AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.