如何使用绑定参数mysqli函数打印上次执行的查询?

时间:2016-01-23 06:25:11

标签: php mysqli bindparam

我使用绑定参数mysqli函数在php中执行查询。但我想每次都打印最后执行的查询。

public function __construct(){
   $this->dbcon = new mysqli('localhost', '*****', '*****', 'db1');
  }

public function get_oderlist($email){
    $emailid = $this->dbcon->real_escape_string($email);
    $stmt =$this->dbcon->prepare("SELECT order_id,email,phone FROM order_historynew where email=? GROUP BY order_id ORDER BY id DESC"); 
    $stmt->bind_param('s',$emailid);  
    $stmt->execute(); 
    $stmt -> bind_result($order_id,$email,$phone);
    while ($stmt->fetch()) {
        $Oderlist[]=array('Order_id'=>$order_id,'Useremail'=>$email,'Phone'=>$phone);
    }     
    if($Oderlist){
        return $Oderlist;
    }else{
        return false; 
    }       
}  

0 个答案:

没有答案