For some reason in Codeigniter, my SQL query is returning repeated replicates of the Object Array based on the number of rows. The weird thing is that my if I put my SQL query directly into phpMyAdmin, it is returning the correct results - and I should add that the code is nearly identical to another call function I have which works normally.
Am I just blind after staring at my code for so long?!
UPDATE: Just a side note, I haven't included my code for manipulation of the $query because my SQL result is already wrong.
Result
CI_DB_mysqli_result Object
(
[conn_id] => mysqli Object
(
// Information
(
)
//Information
)
[result_id] => mysqli_result Object
(
[current_field] => 0
[field_count] => 4
[lengths] =>
[num_rows] => 2
[type] => 0
)
[result_array] => Array
(
)
[result_object] => Array
(
[0] => stdClass Object
(
[id] => 1594
[user_id] => 102
)
[1] => stdClass Object
(
[id] => 1279
[user_id] => 102
)
)
[custom_result_object] => Array
(
)
[current_row] => 0
[num_rows] =>
[row_data] =>
)
1
CI_DB_mysqli_result Object
(
[conn_id] => mysqli Object
(
// Information
(
)
//Information
)
[result_id] => mysqli_result Object
(
[current_field] => 0
[field_count] => 4
[lengths] =>
[num_rows] => 2
[type] => 0
)
[result_array] => Array
(
)
[result_object] => Array
(
[0] => stdClass Object
(
[id] => 1594
[user_id] => 102
)
[1] => stdClass Object
(
[id] => 1279
[user_id] => 102
)
)
[custom_result_object] => Array
(
)
[current_row] => 0
[num_rows] =>
[row_data] =>
)
1
Code
function data($update_id) {
$query = $this->db->query('
SELECT *
FROM `list`
JOIN `tasks` ON list.id = tasks.list_id
WHERE (tasks.date < \' 2016-03-19 \' AND tasks.list_id = '$update_id')
ORDER BY `tasks`.`date` DESC
');
return $query;
}
And I get the result above. There isn't even a loop in my code, so I don't understand where the loop would come from...
I appreciate your assistance.
use return $query->result(); instead of return $query
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.