douniewei6346 2013-09-25 06:00
浏览 39

PHP分页限制

In my controller I have the following code:

if($action=='shipping_list'){ 
    $numrows=inquire_row(); //Get number of rows in query
    $pages= new Paginator('10', 'p'); //create object
    $pages->set_total($numrows);
    $shipping=shipping_list(); //Goes to model
    include('shipping_list.php');
}

In my model I these codes:

function shipping_list(){
    global $MEMS;
    global $pages;
        $query = "SELECT * FROM Inventory " .$pages->get_limit()
        ." WHERE Yield >=320 AND (Q = 'Pass' OR Q='No Q') AND shipdate = ' '
        ORDER BY Wafer ASC, RC ASC";
    $shipping = $MEMS -> query($query);
    return $shipping;
}

The object get_limit is suppose to output a query that starts the query depends on what page the user is on:

public function __contruct($perPage, $instance){
    $this->_instance = $instance;       
$this->_perPage = $perPage; 
}

public function get_limit(){
    return "LIMIT ".$this->get_start().",$this->_perPage";
}

However, when I echo $query, I get the following:

SELECT * FROM Inventory LIMIT 0, WHERE Yield >=320 AND (Q = 'Pass' OR Q='No Q') AND shipdate = ' ' ORDER BY Wafer ASC, RC ASC

So for some reason, the _perPage constant doesn't output. I'm new to OOP so any pointers would be appreciated.

  • 写回答

1条回答 默认 最新

  • drbii0359 2013-09-25 06:03
    关注

    You are using wrong naming for construct:-

     public function __contruct($perPage, $instance){
                          ^
    

    It should be

    public function __construct($perPage, $instance){
    
    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度