Connect to mysql





5
Date Submitted Tue. Feb. 27th, 2007 5:45 AM
Revision 1 of 1
Helper lolfejs
Tags mysql
Comments 0 comments
How to connect to your mysql serve


<?php
$host = "localhost";
//Select your host (ip), often "localhost"
$user = "root";
//Select your username to your mysql server
$pass = "PASSWORD";
//Select your password to your mysql server
$db_name = "DATABASE";
//Select your database

mysql_connect("$host", "$user", "$pass")or die("Cannot connect to server");
//Connect to your mysql
mysql_select_db("$db_name")or die("Cannot locate your database");
//Selecting your database
?>

 

Mattias Pedersen

Comments

There are currently no comments for this snippet.

Voting

Votes Down