[eluser]alexbet[/eluser]
Hi All,
This is driving me nuts, and any help is appreciated. Here is my code:
Code:
$sql = "SELECT SUM(cf_revshareCommissions.commission) AS commission
FROM cf_revshareCommissions, tblMerchants
WHERE cf_revshareCommissions.merchantid=tblMerchants.merchantid
AND cf_revshareCommissions.userid=".$userid."
AND cf_revshareCommissions.eventdate >= ".$start_date."
AND cf_revshareCommissions.eventdate <= ".$end_date."
AND cf_revshareCommissions.locked='0'
AND cf_revshareCommissions.bad=0
AND cf_revshareCommissions.merchantid=".$merchantid."
GROUP BY cf_revshareCommissions.merchantid
LIMIT 1
";
$query = $this->db->query($sql);
if ($query->num_rows() > 0)
{
$row = $this->$query->row();
$commission = $row->commission;
}
I am getting a result of 1.32 when I run that query on the MySql server directly.
With Codeigniter though, I am getting this error:
Message: Object of class CI_DB_mysql_result could not be converted to string
And the line that I am getting the error on is this one:
$row = $this->$query->row();
What could I be doing wrong? I really have no idea why I am getting this error as I have 3 more queries like this with different parameters that don't give me an error.