Welcome Guest, Not a member yet? Register   Sign In
can't pull values from table but insert is ok
#1

[eluser]teddy[/eluser]
I waste a lot of time because I can't select some values from table, I can insert to database table on host but can't get it with select query, at local everything is ok I can select, insert.

And below is my code, if I remove two lines mark [x] I can load view template success, If not the browse firefox, chrome is not show anything I just get a white page, I don't know where is my wrong, thank you for reading my topic

My autoload.php

Code:
$autoload['libraries'] = array('database','session');

My common model
Quote:function getTinhThanhPho()
{

$sql="select id,ten_tinh from tbl_tinhthanhpho";
$rs=$this->db->query($sql)->result_array();

return $rs;
}

and in my controller function I get values return from common model

Quote:function show()
{
[x] $tinhthanhpho=$this->common_model->getTinhThanhPho();
[x] $data['tinhthanhpho']=$tinhthanhpho;
$this->load->view('index',$data);
}
#2

[eluser]CroNiX[/eluser]
Are you loading the model?

Do you have php error reporting turned on? Do you have display_errors turned on? I'm guessing not or you probably wouldn't see a white page. You'd see the errors.
#3

[eluser]teddy[/eluser]
@CroNiX: thank you for your reply

Yes of course I had declare construct function in HomePage controller but nothing happen, and how can I display_errors turn on or php error reporting turned on in codeigniter

Code:
function __construct()
{

parent::__construct();  
$this->load->model('common_model');
  
}
#4

[eluser]teddy[/eluser]
finally, I found that my password connect to database is wrong, and I connected to database is ok.
#5

[eluser]CroNiX[/eluser]
How were you inserting if the password was wrong?




Theme © iAndrew 2016 - Forum software by © MyBB