Welcome Guest, Not a member yet? Register   Sign In
Possibly bug or incorrect code?
#8

$this->db->query(...) returns an object, not an array with the records from the table.
To fetch the records from the query object, you need to do this:

PHP Code:
$records $query->result();  //returns an array of objects, each object is a table record
//or 
$records $query->result_array();  // returns an array of arrays, each sub-array is a table record 

You can use foreach { } to cycle through the records and to get access to the fields inside each record:

PHP Code:
foreach ($records as $record) {
 
 // ...

Reply


Messages In This Thread
Possibly bug or incorrect code? - by cyborg - 07-04-2017, 02:36 PM
RE: Possibly bug or incorrect code? - by Wouter60 - 07-04-2017, 10:42 PM
RE: Possibly bug or incorrect code? - by rtenny - 07-05-2017, 01:15 AM
RE: Possibly bug or incorrect code? - by cyborg - 07-05-2017, 05:44 AM
RE: Possibly bug or incorrect code? - by Wouter60 - 07-05-2017, 10:34 PM



Theme © iAndrew 2016 - Forum software by © MyBB