Reputation: 23
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.
Upvotes: 0
Views: 62
Reputation: 7776
You are using wrong naming for construct:-
public function __contruct($perPage, $instance){
^
It should be
public function __construct($perPage, $instance){
Upvotes: 2