• Log in or sign up for an account here: https://www.sythe.org/login

Connect Mysql and PHP

Raid500

Forum Addict
Joined
Feb 11, 2007
Sythe Gold
0
Messages
592
How to connect php with a mysql database

Code:
<?php
$host = 'localhost'; //127.0.0.1 or 0.0.0.0 (Connects to your computer)
$user = 'root'; //username of the db
$pass = 'password'; //pass to db
$databaseconnection = mysql_connect($host, $user, $pass) //the connection
?>

The first line of code is the php tag.
The second line of code is the ip or the mysql database
The third line of code is the username for the mysql database
The fourth line of code is the password
The fifth line is the actually connection to the database
The sixth line is the end php tag

Raid
 
Back
Top