CodeIgniter Forums

Full Version: help: unable to retrieve $item value
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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.,

El Forum

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

El Forum

[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(

El Forum

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

El Forum

[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

El Forum

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

El Forum

[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.

El Forum

[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.

El Forum

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

follow this link..


master-detail jqgrid solution