var $dns = "127.0.0.1"; //This is "localhost" or "127.0.0.1" that is server name.
var $user "localhost"; //This is User that fixed to use this Database.
var $pass =""; //Password of that User.
var $dbname ="leave"; //DB name will be connected.
var $connect ;
var $result;
function dbase(){
$this->connect = mysql_connect($this->dns,$this->user,$this->pass) or die("ไม่สามารถติดต่อฐานข้อมูลได้");
}
function SetQuery($query){
return $this->result=mysql_db_query($this->dbname,$query);
}
function GetResult(){
if($this->result)
{
return mysql_fetch_array($this->result);
}
return 1;
}
function GetRow(){
return mysql_num_rows($this->result);
}
function GetField(){
return mysql_num_fields($this->result);
}
function DisConnect(){
return mysql_close($this->connect);
}
}
var $dns = "127.0.0.1"; //This is "localhost" or "127.0.0.1" that is server name. var $user "localhost"; //This is User that fixed to use this Database.
var $pass =""; //Password of that User.
var $dbname ="leave"; //DB name will be connected.
เออ...... ผมว่าน่าจะผิดตรงนี้แล้วแหละ ตรงนี้มันน่าจะใช้ root หรือ user อื่นๆ ของ mysql อะ แก้ตรงนี้ก่อน ถ้ายัง error อยู่ค่อยว่ากัน
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in C:\AppServ\www\Vacation_project\class\connect.php on line 14
ไม่สามารถติดต่อฐานข้อมูลได้
var $dns = "localhost"; //This is "localhost" or "127.0.0.1" that is server name.
var $user "root"; //This is User that fixed to use this Database.
var $pass =""; //Password of that User.
var $dbname ="leave"; //DB name will be connected.