Welcome Guest, Not a member yet? Register   Sign In
Save a re-ordered list with Jquery Sortable to DB [SOLVED]
#6

[eluser]eoinmcg[/eluser]
ok, time for some debugging. i see that your ajax request will populate <div id="test"></div> with whatever the server returns...

so, in your controller, let's output the sql statements to see what's being done and then exit. this will then be put into the #test div
Code:
function order()
    {    
        $items = $this->input->post('item');
        $total_items = count($this->input->post('item'));

        echo '<h3>Debugging</h3>';
        echo "<p>Total items sent: $total_items</p>";
            for($item = 0; $item < $total_items; $item++ )
            {

                    $data = array(
                        'id' => $items[$item],
                        'order' => $order = $item
                    );

                     $this->db->where('id', $data['id']);

                    $this->db->update('ft_upload_data', $data);
                    echo '<br />'.$this->db->last_query();
                }
                exit;

    }

btw, i'm assuming that id is your primary key in ft_upload_data


Messages In This Thread
Save a re-ordered list with Jquery Sortable to DB [SOLVED] - by El Forum - 12-09-2010, 04:39 AM



Theme © iAndrew 2016 - Forum software by © MyBB