CodeIgniter Forums
help: unable to retrieve $item value - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: help: unable to retrieve $item value (/thread-26741.html)



help: unable to retrieve $item value - El Forum - 01-21-2010

[eluser]kikz4life[/eluser]
Code:
function getDetailList() //Show the list of registered user with company details
    {
        $item = $this->input->post('item');
        $sortname = $this->input->post('sortname');
        $sortorder = $this->input->post('sortorder');

        if (!$sortname) $sortname = 'a.user_id';
        if (!$sortorder) $sortorder = 'DESC';
        
        $page = 1;
        
        $this->db->start_cache();
                
        $this->db->join('maint_company erp_b','a.company_id=b.company_id','left');
        $this->db->from('sec_companyaccess erp_a');
        $this->db->where('erp_a.user_id',$item);
        $num = $this->db->count_all_results();
        
        
        $this->db->select("a.company_access_id as pkey,a.company_access_id, b.company_code, b.company_name,a.company_id ");
        $this->db->order_by($sortname,$sortorder);
        
        $query = $this->db->get("sec_companyaccess erp_a");
    
        $this->db->flush_cache();
        
        $data['db'] = $query;        
        $data['page'] = $page;
        $data['num'] = $num;
        return $data;            
    
    }

help anyone. i've been working on a master-detail grid. But to be able to do this i must get the value of $item. If i replace the $item to 1 or 2, records display.

FYI: this is what my firebug gets:
Code:
{
page: 1,
total: 0,
rows: []
}

any pointers/ suggestion will do..

cheers to all.,


help: unable to retrieve $item value - El Forum - 01-22-2010

[eluser]John Pantoja[/eluser]
echo out item and see if it's populated


help: unable to retrieve $item value - El Forum - 01-22-2010

[eluser]kikz4life[/eluser]
first of all thanks for the reply... Smile

thats the problem, i cant echo out the $item
tried using this echo $item or print_r $item but no return? Sad(


help: unable to retrieve $item value - El Forum - 01-22-2010

[eluser]John Pantoja[/eluser]
try a var_dump on post or echo "---" . $item . "---"; that way if it's null or zero.


help: unable to retrieve $item value - El Forum - 01-22-2010

[eluser]kikz4life[/eluser]
tried echoing with this:
Code:
$item = $this->input->post('item');
        var_dump($item);
        echo "—-" . $item . "—-";
....
....
        $this->db->where("sec_companyaccess.user_id", $item);
        var_dump($item);
        echo "—-" . $item . "—-";

and got this error in firebug
Code:
bool(false)
—-—-bool(false)
—-—-<br />
<b>Fatal error</b>:  ob_start() [&lt;a href='ref.outcontrol'&gt;ref.outcontrol&lt;/a&gt;]: Cannot use output buffering in output buffering display handlers in <b>C:\xampp\htdocs\comunion\system\libraries\Exceptions.php</b> on line <b>162</b><br />

thanks again for the help


help: unable to retrieve $item value - El Forum - 01-22-2010

[eluser]anthrt[/eluser]
turn off gzip compression in the config file and re-enable it when you've finished testing everything.


help: unable to retrieve $item value - El Forum - 01-22-2010

[eluser]John Pantoja[/eluser]
I don't know CI enough on this matter, perhaps this is what the debug option is in the config(figured output was being buffered)?? I'm still thinking in non framework mode.

Basically what it seems is
Code:
$this->input->post('item')
is not being populated. Probably could try
Code:
if (!isset($this->input->post('item')) || $this->input->post('item') === "") { throw new Exception("Nothing here");} else {$item = $this->input->post('item');}

Or set item to 1 as I assume it's an index for a unique record. I have yet to read error handling and debugging so I'm not sure how else to get around this.


help: unable to retrieve $item value - El Forum - 01-25-2010

[eluser]maria clara[/eluser]
[quote author="John Pantoja" date="1264224352"] Probably could try
Code:
if (!isset($this->input->post('item')) || $this->input->post('item') === "") { throw new Exception("Nothing here");} else {$item = $this->input->post('item');}

Or set item to 1 as I assume it's an index for a unique record. I have yet to read error handling and debugging so I'm not sure how else to get around this.[/quote]

hi,
i tried your script but it shows an error.


help: unable to retrieve $item value - El Forum - 02-02-2010

[eluser]cestaz18[/eluser]
Already solved...^^

follow this link..


master-detail jqgrid solution