[eluser]vincej[/eluser]
Hi- I keep getting a DB error informing me that an argument is missing from my controller function. I had believed from the user guide that I could pass a variable through an anchor(). In my design the view passes a variable ( $customerid)to my controller through an anchor. In turn the controller passes the variable on to my model where the query is executed.
I'm either wrong or implementing it wrong. The various abbreviated code sections are provided below. I have confirmed with a print_r that my starting point, $customerid contains a valid value :
View:
Code:
$customerid = ($_SESSION['userid']);
blah, blah,
<?php echo anchor('welcome/order_history', "Customer Order History", $customerid);
Controller
Code:
function order_history($customerid){
$data['orders'] = $this->MOrders->read_order($customerid);
$data['main'] = 'order_history';
$data['title'] = "My site | Order History";
$data['navlist'] = $this->MCats->getCategoriesNav();
$this->load->vars($data);
$this->load->view('template');
;}
Model
Code:
function read_order($customerid){
$sql = "SELECT order.orderid,
blah blah
AND order.customerid = $customerid
$Q = $this->db->query($sql);
if ($Q->num_rows() > 0){
$orders = $Q->result_array();
$Q->free_result();
return $orders;
A Very Big Thanks to all those who might be able to help !