CodeIgniter Forums
[SOLVED!] unable to retrieve detail list - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: [SOLVED!] unable to retrieve detail list (/showthread.php?tid=26876)

Pages: 1 2


[SOLVED!] unable to retrieve detail list - El Forum - 01-25-2010

[eluser]maria clara[/eluser]
hi to all,

i have a jqgrid with a detail list but the content don't show the item from a joined table. its not retrieving the $item for the details...here's my code:
Code:
function getDetailList() //Show the list of registered user with company details
    {
        $item = $this->input->post('item');

        $page = $this->input->post('page');
        $limit = $this->input->post('rows'); // get how many rows we want to have into the grid
        $sidx = $this->input->post('sidx'); // get index row - i.e. user click to sort
        $sord = $this->input->post('sord'); // get the direction
        
        $query = $this->input->post('query');
        $qtype = $this->input->post('qtype');
        
        if (!$sidx) $sidx = 'sec_companyaccess.user_id'; // if we not pass at first time index use the first column for the index
        if (!$sord) $sord = 'asc';
                
        if (!$page) $page = 1;
        if (!$limit) $limit = 25;
        
        $start = (($page-1) * $limit);
    
        $this->db->start_cache();
            $this->db->join('maint_company','sec_companyaccess.company_id=maint_company.company_id','left');
        $this->db->join('sec_users ','sec_companyaccess.user_id=sec_users.user_id','left');
        $item = $this->input->post('sec_users.user.id');
        $this->db->from('sec_companyaccess');
        #$this->db->where("sec_companyaccess.user_id", $item);
        $this->db->where("sec_companyaccess.user_id", $item);
        $count = $this->db->count_all_results();
        
        
        if( $count > 0 && $limit > 0) {
              $total_pages = ceil($count/$limit);
        } else {
              $total_pages = 0;
        }
        
        
        if ($page > $total_pages) $page=$total_pages;
        $start = $limit * $page - $limit;
        if($start <0) $start = 0;
        
        $this->db->select("sec_companyaccess.company_access_id as pkey,sec_companyaccess.company_access_id, maint_company.company_code, maint_company.company_name,sec_companyaccess.company_id ");
        $this->db->order_by($sidx,$sord);
        $this->db->limit($limit, $start);
        $query = $this->db->get("sec_companyaccess");
        $this->db->flush_cache();
        
        $data['db'] = $query;
        $data['page'] = $page;
        $data['totalpages'] = $total_pages;
        $data['totalrecords']=$count;
        return $data;    
    
    }
this script wasn't working $item = $this->input->post('item');
anyone could help??

thanks,


[SOLVED!] unable to retrieve detail list - El Forum - 01-26-2010

[eluser]Ben Edmunds[/eluser]
if you do a print_r on $_POST is item in the array?


[SOLVED!] unable to retrieve detail list - El Forum - 01-26-2010

[eluser]maria clara[/eluser]
hi, i already did the print_r() and it shows this in my console:
Quote:{
page: 0,
total: 0,
records: 0,
rows: []
}

and when i tried to put $_POST it shows an error.
i have here attached image of the listview and the detaillistview. when you select an item in the listview, the detaillistview will be shown but the jqgrid there is blank because of i can't retrieve the value of the $item.


[SOLVED!] unable to retrieve detail list - El Forum - 01-26-2010

[eluser]Ben Edmunds[/eluser]
Hey,

You have to do:

Code:
print_r($_POST);

because $_POST is an array and print_r prints arrays.


[SOLVED!] unable to retrieve detail list - El Forum - 01-26-2010

[eluser]maria clara[/eluser]
is this right?? i do this:
$item = $this->input->post('item');
print_r($_POST);

this shows an error with my jquery plugin.

or like this:

$item = $this->input->post('item');
print_r($_POST['item']);



they both have the same error.


[SOLVED!] unable to retrieve detail list - El Forum - 01-26-2010

[eluser]Ben Edmunds[/eluser]
You want to do print_r($_POST);

What error are you getting?


[SOLVED!] unable to retrieve detail list - El Forum - 01-26-2010

[eluser]maria clara[/eluser]
this is what im getting when i use print_r($_POST)
Quote:syntax error
[Break on this error] [_search] => false\n
jquery....min.js (line 12)

syntax error
[Break on this error] [_search] => false\n



[SOLVED!] unable to retrieve detail list - El Forum - 01-26-2010

[eluser]Ben Edmunds[/eluser]
Thats fine. The print_r is probably just screwing up your js output.

View source and find the print_r and see what you have there.


[SOLVED!] unable to retrieve detail list - El Forum - 01-26-2010

[eluser]maria clara[/eluser]
i viewed the source and have found this
<a href="#" title="Print"><span class="disabled" title="Print"><b class="item_print"></b></span></a>


what does it mean?? because still the data in the detaillistview doesn't show up.


[SOLVED!] unable to retrieve detail list - El Forum - 01-26-2010

[eluser]maria clara[/eluser]
i used to do this
Code:
$item = $this->input->post('item');
        print_r($item);

and tried to change the value of the $item here
Code:
$this->db->where("sec_companyaccess.user_id", $item);

$item is not retrieving any value that's why there's no details shown in the detaillistview.