Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter v1.7.2 Released
#41

[eluser]Derek Jones[/eluser]
You can either modify the code as you stated above, or build the query manually for now.
#42

[eluser]ELRafael[/eluser]
Thanks
in system/database/DB_active_rec.php, line 613
Code:
function like($field, $match = '', $side = 'both', $escape = TRUE)
{
  return $this->_like($field, $match, 'AND ', $side, '', $escape);
}

in system/database/DB_active_rec.php, line 697 and 710
L: 619
Code:
function _like($field, $match = '', $type = 'AND ', $side = 'both', $not = '', $escape = TRUE)
L: 710
Code:
if ($escape === TRUE)
  $v = $this->escape_like_str($v);

My code:
Code:
$this->db->like('title', $title, 'before', FALSE);

IMHO
CodeIgniter is a great job. But I believe that you should pay more attention when put a change like this.
"Or I write the SQL Query and don't use Active Record or I can't use wildcards in Active Record".
I know 99% the escape is an amazing feature. But in this case, didn't result :-S
#43

[eluser]Derek Allard[/eluser]
Rafael, active record cannot be everything to everyone. Like all tools in CI, it is meant to help you out, but it can't read your mind. If you have a non-standard query, or a situation with special needs, CI provides you with the ability to run queries.

At any rate, your first instinct that maybe this thread isn't the best place to discuss it is probably right, if you want to add more about Active Record or any shortcomings you perceive, please feel free to start a new thread so the community can discuss.

Thanks for the kind words!
#44

[eluser]dbashyal[/eluser]
Wow good to know new version available. I am bit late to find out this though Sad

Someone who taught me codeigniter was going to move away from CI, which was his favorite, after getting Snow leopard. Hopefully this release will help him to stay with CI.

And, hopefully this will solve my current issue 'Mysql server gone away'. Will try this tomorrow morning.
#45

[eluser]sihijau[/eluser]
i think therese bugs in the cart class, because i try using this library when i insert new item or update cart, the item in shoppingcart is reset to 1 item.
exactly like this case

my controller code:
Code:
<?php
class cart extends Controller{
    //
    function cart(){
        parent::Controller();
        
        $this->load->library('cart');
    }
    //
    function index(){
        
        $this->view_cart();
    }
    
    function add(){
        $pid = $this->input->post('product_id');
        //
        $q = $this->db->get_where('product',array('product_id'=>$pid),1);
        if($q->num_rows() > 0){
            $item = $q->row();
            
            //
            $data = array('id' => $item->product_id,
                          'qty' => 1,
                          'price' => $item->product_price,
                          'name' => $item->product_sku."".$item->product_name
            );
            
            $this->cart->insert($data);
        }
        redirect('cart/view_cart');
    }
    
    ////
    function view_cart(){
        
        $data['custom_jquery'] = '
        $("input[name=\'delete\']").click(function(){
           var status = $(this).val();
           location.href = "'.site_url('cart/delete').'/" + status;
        })';
        $data['ptitle'] = 'CoderShop | View Cart';
        $this->load->view('view_cart',$data);
    }
    
    function update(){
        
        //Get number of items in cart
        $count = $this->cart->total_items();
        
        //Get info from POST
        $item = $this->input->post('rowid');
        $qty = $this->input->post('qty');
        
        //Step through items
        for($i=0;$i < $count;$i++)
        {
            $data = array(
               'rowid' => $item[$i],
               'qty'   => $qty[$i]
            );
            $this->cart->update($data);
        }
        
        redirect('cart/view_cart');
    }
    
    function delete()
    {
        $row_id = $this->uri->segment(3,FALSE);
        $data = array('rowid'=>$row_id,
                      'qty' => 0);
        $this->cart->update($data);
        
        redirect('cart/view_cart');
    }
}
?&gt;

could anyone help me?
sorry if i posted in wrong place :down:




Theme © iAndrew 2016 - Forum software by © MyBB