Reputation: 979
I wonder if the following codes do the same thing?
1
if ($query->num_rows() == 1) {
$row= $query->row_array();
$path = $row['path'];
$photo = $row['photo'];
}
2
if ($query->num_rows() == 1) {
foreach ($query->result() as $row){
$path = $row->path;
$photo = $row->photo;
}
}
Upvotes: 0
Views: 26
Reputation: 6258
Yes. One gets the result as an object the other an associative array. Same result.
Upvotes: 2