如何移动下一个和上一个billno(从数据库中提取)并使用codeigitter在视图页面中显示


how to move previous and next billno and 
view in the view page.

public function Bill_Prev1(){
$this->db->query('SELECT * from salesitem where billno = 1 AND 
billno > 1 ORDER BY billno ASC LIMIT 1;')->result_array();
$this->db->join('salesbill', 'salesbill.no = salesitem.billno','left 
outer');
$this->db->join('parmaster','parmaster.Pcode = 
salesbill.partyname','left outer');
$query = $this->db->get()->row();
return $query;
}
public function Bill_Prev(){
$query = $this->db->query('SELECT * from 
salesitem where billno = 1 AND billno > 1 
ORDER BY billno ASC LIMIT 1;')- 
>result_array();

return $query;
}

这是型号代码。。。。。。。。。。。。。。

我的prblm是如何移动上一个和下一个不使用codeighter。。。。。。。。。。

传递当前票据编号和订单(next/pre(。

public function Bill_NextPrev($billNo=0,$order='next'){
if($order='next'){
$this->db->where('s.billno >', $billNo);
}else{
$this->db->where('s.billno <', $billNo);
}
$this->db->limit(1);
$this->db->from('salesitem as a');
$query = $this->db->get();
if( $query->num_rows() == 1 ){ 
return  $query->result();
}
return false;
}

最新更新