Welcome Guest, Not a member yet? Register   Sign In
Unable to fetch record from model to view
#11

[eluser]Jawed[/eluser]
Hi gtech

Thanks for the quick and conceptual reply. I was not aware of this fact.. Thanks a lot
#12

[eluser]gtech[/eluser]
your welcome.
#13

[eluser]Jawed[/eluser]
I got your point means If the result set has three filed suppose name, address, location .
and I did this

$val['res']=$this->aaaa->view_kkk();

in the controller then in the view i should use $res['name'],$res['address'],$res['location']. And by this way i am getting data on the view but this is not happening on the server (webserver).Can you please advice what the reason can be...
Do I have to change some setting on the server...
#14

[eluser]gtech[/eluser]
looks like your model returns an object not an array so your view should be
Code:
//<?=$res->name?>
//EDIT should of been a loop.
foreach ($res->result() as $row)
{
   echo $row->name;
}
note the <?= is the same as doing <?php echo

or change the model to use arrays
Code:
$view_d=$this->db->query("select * from table");
      return $view_d->result_array();
#15

[eluser]Jawed[/eluser]
yes i am using the $view_d->result_array(); and it is displaying true result but on the server it is not displaying anything...and since i user the $view_d->result_array(); and suppose it has three filed name, address,location then i am calling them as $res[‘name’],$res[‘address’],$res[‘location’].These var are returning values on the localhost, but not on server ...
#16

[eluser]gtech[/eluser]
hummmmm.. ok not a lot to go on.. if your server on localhost works, sounds like a configuration/path issue with the remote server. a blank page can often mean there is a php error, I suggest turn the logging on to maximum in your config file, and then check the system/logs directory to see if there are any obvious errors.
#17

[eluser]Jawed[/eluser]
Thanks for the help buddy, I got the problem and fixed it...Anyway thanks for the help Smile
#18

[eluser]gtech[/eluser]
forgot to mention $res will contain a numerical key for the database row.
Code:
$res[0]['address'];




Theme © iAndrew 2016 - Forum software by © MyBB