php database connection
Posted by: wili (
Date: January 20, 2006 06:12AM

I made a working simple registration php.
then i made a simple databse in wamp..
how can i connect the databes and the php?

Options: ReplyQuote
Re: php database connection
Posted by: Kyrin (
Date: January 20, 2006 08:50AM

require("const.php"winking smiley;

class mysql{
public $connection;

public function mysql(){
$this->connection = mysql_connect(db_host, db_user, db_pass) or die(mysql_error());
mysql_select_db(db_data, $this->connection) or die(mysql_error());

function query($query){
return mysql_query($query, $this->connection);

/* Create database connection */
$database = new mysql;




//define for datasbase
define("db_user", "root"winking smiley;
define("db_pass", ""winking smiley;
define("db_host", "localhost"winking smiley;
define("db_data", "journal"winking smiley;




$host = ' ';
$user = ' ';
$pass = ' ';
$db = ' ';

$q = mysql_connect($host, $user, $pass) or die("Couldn't Connect To Datebase"winking smiley;
mysql_select_db($db, $q) or die("Couldn't Select DataBase"winking smiley;


Options: ReplyQuote

Sorry, only registered users may post in this forum.