Hi Guys I've now sorted the sql query and the database is now sorted, but now I want to connect the PHP and sql database

Config.php file

//Mysql Connect  |   mysql_connect("host","username","password");
//Below example to connect in localhost

//select your database

I take it I need to specify the "host", "username" and "password" on phpmyadmin this is where the info is I take it? and I also need to specify the "dababase" name

Any help would be brilliant

4 Years
Discussion Span
Last Post by stokie-rich

Yes, on the link you have examples for "mysqli" and "mysql" connect they both work but if you have older versions of PHP server use "mysql" connect.

mysql_connect("host", "admin", "password") or die(mysql_error()); 

First you defind your host that is address from your server.
"admin" is your user who have access to database and "password" is your password for database. If you didn't put any password, they can be blank in many cases...
Then you connect to your database schema:

mysql_select_db("name_of_database") or die(mysql_error()); 

and then you can do some sql queries...

$data = mysql_query($sql) or die(mysql_error());
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.