我是CodeIgniter的新手,我试过阅读CI的文档,但我仍然无法解决我的问题,也许有人可以帮我解决问题.这是我的代码:
在我的控制器中
class Registration extends CI_Controller{
function __construct(){
parent::__construct();
$this->load->model('registration_model','rmod');
}
function ambil() {
$gender = $this->input->post('kelamin');
$tinggi = $this->input->post('height');
$berat = $this->input->post('weight');
$weight = $this->rmod->ambilBeratPria($tinggi);
echo $weight;
}
Run Code Online (Sandbox Code Playgroud)
在我的模型中
function ambilBeratPria($tinggi) {
$this->db->select('berat')->from('pria')->where('tinggi',$tinggi);
$query = $this->db->get();
return $query;
}
Run Code Online (Sandbox Code Playgroud)
我想在模型中获得我的查询结果,但是我得到这样的错误:
Message: Object of class CI_DB_mysql_result could not be converted to string
也许这里有人可以帮我解决问题?谢谢.