简体   繁体   中英

How to get all the rows when executing query in codeigniter?

I have question in codeigniter.

  1. Get All the rows when Executing the Query

In CI I want to get all the rows when I am executing the query like

Select * from tablename

But when I am using the

return $query->row();

I am getting only one row.How can I get all the rows.I dont get any idea in this article

instead of this

$query->row();

use this

foreach ($query->result() as $row)
{
    echo $row->field_name;
    //use the database table fields name in the place of field_name property
}

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM