php - Model file not returning values in codeigniter -
my model file working on localhost when upload, returns null values. please explain me how database.php
wrong.
my database.php
:
$active_group = 'default'; $active_record = true; $db['default']['hostname'] = 'http://niation.com'; $db['default']['username'] = 'nire'; $db['default']['password'] = 'xxxxu23'; $db['default']['database'] = 'trrtuu'; $db['default']['dbdriver'] = 'mysql' $db['default']['dbprefix'] = ''; $db['default']['pconnect'] = true; $db['default']['db_debug'] = false; $db['default']['cache_on'] = false;
my model file:
<?php class play extends ci_model { function getdata() { $data = $this->db->select('info')->get('home'); return $data->result(); }
my controller file
class nirmal extends ci_controller { public function about() { $this->load->model('play'); $data['info']=$this->play->getdata(); $this->load->view('main1',$data); }
my view file
<?php foreach ($info $item):?> <p><?php echo $item->info;?></p> <?php endforeach;?>
i think hostname wrong, default mysql connections not through http.
check if can connect database machine locally, check similar question may troubleshoot.
Comments
Post a Comment