我正在尝试从db中获取一些数据,但是mysqli fetch()函数没有获取/不工作,它正在返回false。下面是我正在使用的函数,请帮助。
public function return_track_order_details($adRef,$transaction_id){
$db = parent::Connect_Database();
$stmt = $db->prepare("SELECT * FROM `s_b_p_h` WHERE `ad_reference` = ? AND `transaction_id` = ? LIMIT 1 ");
$stmt->bind_param('ss',$adRef,$transaction_id);
$stmt->execute();
$stmt->bind_result(
$id,
$date,
$name,
$email,
$phone,
$full_address,
$total_amount_paid,
$buyers_account_id,
$sellers_account_id,
$ad_reference,
$transaction_id,
$status_by_buyers,
$status_by_sellers,
$net_status
);
if($stmt->fetch()){
$id = $this->xss_clean($id);
$date = $this->xss_clean($date);
$name = $this->xss_clean($name);
$email = $this->xss_clean($email);
$phone = $this->xss_clean($phone);
$full_address = $this->xss_clean($full_address);
$total_amount_paid = $this->xss_clean($total_amount_paid);
$buyers_account_id = $this->xss_clean($buyers_account_id);
$sellers_account_id = $this->xss_clean($sellers_account_id);
$ad_reference = $this->xss_clean($ad_reference);
$transaction_id = $this->xss_clean($transaction_id);
$status_by_buyers = $this->xss_clean($status_by_buyers);
$status_by_sellers = $this->xss_clean($status_by_sellers);
$net_status = $this->xss_clean($net_status);
}else{
return false;
}
}我做错什么了吗?
我使用了也检查我的声明是否正确,也检查它是否执行。
发布于 2014-08-30 00:18:06
我在这里想做的事很有趣。也许是因为工作过度。
我没有从这个函数返回任何东西,即使mysqli粪返回true。
因此,我修改if($stmt->()){}语句以返回数组.
if($stmt->fetch()){
$id = $this->xss_clean($id);
$date = $this->xss_clean($date);
$name = $this->xss_clean($name);
$email = $this->xss_clean($email);
$phone = $this->xss_clean($phone);
$full_address = $this->xss_clean($full_address);
$total_amount_paid = $this->xss_clean($total_amount_paid);
$buyers_account_id = $this->xss_clean($buyers_account_id);
$sellers_account_id = $this->xss_clean($sellers_account_id);
$ad_reference = $this->xss_clean($ad_reference);
$transaction_id = $this->xss_clean($transaction_id);
$status_by_buyers = $this->xss_clean($status_by_buyers);
$status_by_sellers = $this->xss_clean($status_by_sellers);
$net_status = $this->xss_clean($net_status);
return array(
$id,
$date,
$name,
$email,
$phone,
$full_address,
$total_amount_paid,
$buyers_account_id,
$sellers_account_id,
$ad_reference,
$transaction_id,
$status_by_buyers,
$status_by_sellers,
$net_status
);
}https://stackoverflow.com/questions/25577678
复制相似问题