I have the following block of code that is expected to return count
$sql = "SELECT sum(count) as count
FROM multipleowners WHERE owner = ? " . $localityquery;
$queryarray = array($owner, $locality);
$query = $this->db->query($sql, $queryarray);
if ($query->num_rows() > 0)
{
$result = $query->row_array();
$count = $result['count'];
}
But I get empty values ββwhen I try to print $count.
I used print_r($this->db->last_query());and I received the following request:
SELECT sum(count) as count FROM multipleowners WHERE owner = 'Davenports Harbour Trustee (2012) Limited' and locality = 'Auckland Central'
When I executed this request directly on mine Postgresql IDE, I got the result countas 2.
What and where this request may be wrong? I doubt the existence (and )the proposal WHERE. How to fix it?
Update
When I turned on the profiler, I received the following request:
SELECT sum(count) as count
FROM multipleowners WHERE owner = 'Davenports Harbour Trustee (2012) Limited' and locality = 'Auckland Central'
Thus, it is obvious that the problem exists on (and )!!
source
share