This is my code in model..
function get_info($product_id)
{
$this->db->from('product');
$this->db->where('product_id',$product_id);
$query = $this->db->get();
if($query->num_rows()==1)
{
return $query->row();
}
So many questions on stackoverflow but I Dont found any answer related to scenario. So what I am doing wrong??
Your query is probably failing. Make sure database debugging in on and modify your code:
if ($query !== FALSE)
{
// Run your code
if ($query->num_rows() === 1)
{
return $query->row();
}
}
else
{
// Check error
echo 'Database Error(' . $this->db->_error_number() . ') - ' . $this->db->_error_message();
}
Seems like you have found nothing as a result, so query returns false. The other option is a problems with db connection, check it in config files.
Are you able to execute any SQL queries? I suspect that your database connection doesn't work at all ... check your DB settings
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.