|
|
|
Warning: mysqli_query() expects at least 2 parameters, 1 given in... |
|
|
|
|
|
|
|
มันอยู่ใน class เดียวกันกับตัวนี้ครับ...
Code (PHP)
private $db_host = 'localhost';
private $db_user = 'root';
private $db_pass = 'root';
private $db_name = 'my_db';
//--- connect --->
public function connect(){
try{
if(!$this->con){
$myconn = mysqli_connect($this->db_host,$this->db_user,$this->db_pass);// or die(mysqli_error());
if($myconn){
$seldb = mysqli_select_db($myconn,$this->db_name);
mysqli_query($myconn,"SET NAMES UTF8");
if($seldb){
$this->con = true;
return true;
}else{
return false; //mysql_error();
}
}else{
return false; //mysql_error();
}
}else{
return false; //mysql_error();
}
}catch(Exception $e){
return $e;
}
}
|
ประวัติการแก้ไข 2010-11-11 10:07:24
|
|
|
|
Date :
2010-11-10 23:58:01 |
By :
t-monroe |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mysqli_query ต้องการ link resource อีก 1 parameter ครับ เหมือนที่คุณเอี่ยวบอก
|
|
|
|
|
Date :
2010-11-11 02:17:24 |
By :
PlaKriM |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$tablesInDb = mysqli_query($this->connect(),"SHOW TABLES FROM ".$this->db_name." LIKE '".$table."'");
ก็ยังไม่ได้ครับ ต้องแก้ยังไงครับ...
|
|
|
|
|
Date :
2010-11-11 10:05:16 |
By :
t-monroe |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( ! $this->connect())
exit('error no connection found.');
$tablesInDb = mysqli_query($this->connect(),"SHOW TABLES FROM ".$this->db_name." LIKE '".$table."'");
แน่ใจว่า method connect() คืนค่า conection นะครับ
|
|
|
|
|
Date :
2010-11-11 11:00:40 |
By :
pjgunner.com |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2012-08-22 15:20:37 |
By :
Pro PHP |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|