2017-04-05 16 views
-2
public function count_all_results($table = '', $reset = TRUE) 
{ 
    if ($table !== '') 
    { 
     $this->_track_aliases($table); 
     $this->from($table); 
    } 

    $result = ($this->qb_distinct === TRUE) 
     ? $this->query($this->_count_string.$this->protect_identifiers('numrows')."\nFROM (\n".$this->_compile_select()."\n) CI_count_all_results") 
     : $this->query($this->_compile_select($this->_count_string.$this->protect_identifiers('numrows'))); 

    if ($reset === TRUE) 
    { 
     $this->_reset_select(); 
    } 

    if ($result->num_rows() === 0) // this is the line with the issue 
    { 
     return 0; 
    } 

    $row = $result->row(); 
    return (int) $row->numrows; 
} 

笨 客戶都在抱怨上提交他們的訂單我的網站有問題,結賬。當我檢查錯誤日誌時,這是我看到的錯誤。我怎樣才能解決這個調用一個成員函數NUM_ROWS()布爾在/home/alabbrkq/public_html/system/database/DB_query_builder.php

下面控制器的區域以字符串count_all_results

$this->db->where('status','ok'); 
     $this->db->where('featured','ok'); 
     $this->db->where('added_by',json_encode(array('type'=>'vendor','id'=>$vendor_id))); 
     // pagination 
     $config['total_rows'] = $this->db->count_all_results('product'); 
     $config['base_url'] = base_url() . 'index.php?home/listed/'; 
     $config['per_page'] = 9; 
     $config['uri_segment'] = 5; 
     $config['cur_page_giv'] = $para2; 

{$ 這 - >負載>庫( 'Ajax_pagination');

$id= $this->session->userdata('user_id'); 
    $this->db->where('from_where','{"type":"user","id":"'.$id.'"}'); 
    $this->db->or_where('to_where','{"type":"user","id":"'.$id.'"}'); 
    $config['total_rows'] = $this->db->count_all_results('ticket'); 
    $config['base_url']  = base_url() . 'index.php/home/ticket_listed/'; 
    $config['per_page']  = 5; 
    $config['uri_segment'] = 5; 
    $config['cur_page_giv'] = $para2; 

{ $這 - >負載>庫( 'Ajax_pagination');

$id= $this->session->userdata('user_id'); 
    $this->db->where('buyer', $id); 
    $config['total_rows'] = $this->db->count_all_results('sale'); 
    $config['base_url']  = base_url() . 'index.php/home/order_listed/'; 
    $config['per_page']  = 5; 
    $config['uri_segment'] = 5; 
    $config['cur_page_giv'] = $para2; 

    $function     = "order_listed('0')"; 
    $config['first_link']  = '«'; 
    $config['first_tag_open'] = '<li><a rel="grow" class="btn-u btn-u-sea grow" onClick="' . $function . '">'; 
    $config['first_tag_close'] = '</a></li>'; 

    $rr      = ($config['total_rows'] - 1)/$config['per_page']; 
    $last_start    = floor($rr) * $config['per_page']; 
    $function     = "order_listed('" . $last_start . "')"; 
    $config['last_link']  = '&raquo;'; 
    $config['last_tag_open'] = '<li><a rel="grow" class="btn-u btn-u-sea grow" onClick="' . $function . '">'; 
    $config['last_tag_close'] = '</a></li>'; 

    $function     = "order_listed('" . ($para2 - $config['per_page']) . "')"; 
    $config['prev_tag_open'] = '<li><a rel="grow" class="btn-u btn-u-sea grow" onClick="' . $function . '">'; 
    $config['prev_tag_close'] = '</a></li>'; 

    $function     = "order_listed('" . ($para2 + $config['per_page']) . "')"; 
    $config['next_link']  = '&rsaquo;'; 
    $config['next_tag_open'] = '<li><a rel="grow" class="btn-u btn-u-sea grow" onClick="' . $function . '">'; 
    $config['next_tag_close'] = '</a></li>'; 

    $config['full_tag_open'] = '<ul class="pagination pagination-style-2 pagination-sm">'; 
    $config['full_tag_close'] = '</ul>'; 

    $config['cur_tag_open'] = '<li class="active"><a rel="grow" class="btn-u btn-u-red grow" class="active">'; 
    $config['cur_tag_close'] = '</a></li>'; 

    $function    = "order_listed(((this.innerHTML-1)*" . $config['per_page'] . "))"; 
    $config['num_tag_open'] = '<li><a rel="grow" class="btn-u btn-u-sea grow" onClick="' . $function . '">'; 
    $config['num_tag_close'] = '</a></li>'; 
    $this->ajax_pagination->initialize($config); 
    $this->db->where('buyer', $id); 
    $page_data['orders'] = $this->db->get('sale', $config['per_page'], $para2)->result_array(); 
    $this->load->view('front/user/order_listed',$page_data); 
} 

{ $這 - >負載>庫( 'Ajax_pagination');

$id= $this->session->userdata('user_id'); 
    $ids = json_decode($this->db->get_where('user',array('user_id'=>$id))->row()->wishlist,true); 
    $this->db->where_in('product_id', $ids); 

    $config['total_rows'] = $this->db->count_all_results('product');; 
    $config['base_url']  = base_url() . 'index.php/home/wish_listed/'; 
    $config['per_page']  = 5; 
    $config['uri_segment'] = 5; 
    $config['cur_page_giv'] = $para2; 

    $function     = "wish_listed('0')"; 
    $config['first_link']  = '&laquo;'; 
    $config['first_tag_open'] = '<li><a rel="grow" class="btn-u btn-u-sea grow" onClick="' . $function . '">'; 
    $config['first_tag_close'] = '</a></li>'; 

    $rr      = ($config['total_rows'] - 1)/$config['per_page']; 
    $last_start    = floor($rr) * $config['per_page']; 
    $function     = "wish_listed('" . $last_start . "')"; 
    $config['last_link']  = '&raquo;'; 
    $config['last_tag_open'] = '<li><a rel="grow" class="btn-u btn-u-sea grow" onClick="' . $function . '">'; 
    $config['last_tag_close'] = '</a></li>'; 

包含字符串count_all_results控制器的我加入的地區我希望這有助於

+0

'num_rows()'不是mysqli_中的函數。 RTM http://php.net/manual/en/mysqli-result.num-rows.php ---除非你有自己的自定義方法,這是未知的。 –

+2

您的查詢失敗。爲什麼?誰知道。嘗試輸出查詢以查明它的外觀,並在數據庫中手動運行它。 – aynber

+0

@ Fred-ii-所以我應該如何解決它,我沒有寫代碼。開發者的支持非常不好。報告了7天前的問題 –

回答

0
var = (condition x) ? y : z; 
condition ? true : false; 

在這裏,我們有真正的「Y」和虛假的「Z」被宣佈爲根據VAR條件。在你的問題中,錯誤表示操作在Boolean上執行,這意味着Y或Z正在返回Boolean而不是值。

請檢查由Y或Z申報的價格,並打印出來的連擊調試,必須有方法你調用或方法返回Boolean,而不是其所需的代碼點火器數據庫庫執行操作Database Object錯誤。

請編輯您的問題,並提供您的連擊方法和準確的答案你的問題。

相關問題