Welcome Guest, Not a member yet? Register   Sign In
Return value of select query with orderby and limit is producing error
#1

[eluser]johnwbaxter[/eluser]
I have in my model:

$this->db->select('orderid');
$this->db->from('orders');
$this->db->where('cust_id =', $cust_id);
$this->db->order_by('orderid', 'DESC');
$this->db->limit(1);
$lastorder = $this->db->get();
return $lastorder;

Then in my controller i have:

$orderid = $this->ordermodel->retorder();

And then i have a line of code that tries to use the $orderid variable to populate the value of a form field.

In my log i have this error:

Severity: Notice --> Object of class CI_DB_mysql_result to string conversion /var/www/vhosts/mysite.com/httpdocs/system/helpers/form_helper.php 360

Any ideas anyone?!

I'm totally stumped. I think it's returning an object instead of a value but i'm not sure why or how to access it if it is in this scenario.


Messages In This Thread
Return value of select query with orderby and limit is producing error - by El Forum - 04-23-2008, 10:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB