• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do I append multiple segments to an anchor

#1
[eluser]vincej[/eluser]
Hi ! I have created an anchor which looks like:

Code:
anchor('admin/pos/open_orders/'.$customerid.'/'.$list['pickupdate'] , $list['firstname']." ". $list['lastname'])

it creates a url like this :
Code:
<a href="http://localhost/countrylane/index.php/admin/pos/open_orders/5/1343800800">

I want to pass the customer id and pickupdate to to my model for inclusion in a query - via the controller of course.

CONTROLLER:

Code:
function open_orders($customerid=""){
    $_SESSION['customerid']=$customerid;
    $this->MPos->open_orders($customerid);
    $data['customer'] = $this->MCustomer->getCustomer($customerid);
    $data['main'] = 'admin_pos_openorders';
    $data['title'] = "Country Lane Farms | Open Orders";
    $this->load->vars($data);
    $this->load->view('dashboard')
    ;}


MODEL:

Code:
function open_orders($customerid){
        { $sql = "SELECT order.prodid, orderid, customerid, weigh, products.pricelb, orderdate, pickupdate, order.price, order.quantity,products.name, order.price*order.quantity AS ordervalue
    FROM `order`,`products`
    WHERE customerid = $customerid
    AND order.status = 'open'
    AND products.id = order.prodid";
    $Q = $this->db->query($sql);
     if ($Q->num_rows() > 0){
     $openorders = $Q->result_array();


I expect that I need to use the uri->segment function.

I'd really appreciate some advice how how to do this - as my attempts so far have all crashed and burned !

Many thanks !





















#2
[eluser]vincej[/eluser]
Panic over - I Have solved it, just me being stupid ! for others the answer is:

Code:
$customerid= $this->uri->segment(4);
$pickupdate = $this->uri->segment(5);


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.