need help variable undefined

#1
[eluser]phpfresher[/eluser]
ERROR:
undefined varible:module_id

Controller:
$data['list_of_module'] = $this->userprofile->list_of_module();

Model:

//returns all module name and id from module table
function list_of_module(){
$query = $this->db->query("select * from module ");
foreach ($query->result() as $row):
$module_id .= $row->id;
$module_id .= ",";
$module_name .= $row->name;
$module_name .= ",";
echo $module_name;
endforeach;
$comma=",";//separate by commas
$module_id = rtrim($module_id,",");
$module_name = rtrim($module_name,",");
$arr_mod_id = explode($comma,$module_id);
$arr_mode_name = explode($comma,$module_name);
$options = array_combine($arr_mod_id,$arr_mode_name);
$data['list_of_module'] = $options;
return $data;
}


VIEW:
<?php

echo form_dropdown('category',@$list_of_module);
?>


Can you help me out why the variable is undefined: the actual output is fine.


Messages In This Thread
need help variable undefined - by El Forum - 05-03-2011, 04:53 AM
need help variable undefined - by El Forum - 05-03-2011, 05:07 AM
need help variable undefined - by El Forum - 05-03-2011, 05:09 AM
need help variable undefined - by El Forum - 05-03-2011, 05:14 AM
need help variable undefined - by El Forum - 05-03-2011, 05:19 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.