reset and begin
7/07/2009

using class connect to data in php

ex: class in php
<?php

class db

{

var $host,$user,$pass,$data;

var $cnn;

function __construct($host,$user,$pass,$data)

{

$this->host=$host;

$this->user=$user;

$this->pass=$pass;

$this->data=$data;



}

function ketnoihost(){

$this->cnn=mysql_connect($this->host,$this->user,$this->pass) or die (mysql_error());

echo"ket noi host ok";

}

function ketnoidb(){

mysql_select_db($this->data,$this->cnn) or die (mysql_error());

echo "ket noi data thanh cong";

}





}

$d=new db("localhost","root","","mysql");

$d->ketnoihost();

$d->ketnoidb()

Bloger Comments
G+ Comments
Comments FaceBook

No comments:

List

Profiles Information


About me : Nothing is 1 vài thứ - 1985

Places I've Lived : I Hà Nội

Home Page : http://www.shimivn.blogspot.com/

Think : 1:1000000000

Languages spoken : Vietnamese,English.

Mobile : sony C2305

dell : i3-Ram 3GB- HDD 250GB .