什么是等价的 make code igniter get and write all variables...
这是我通常会做的事情:
$get = mysql_query("SELECT * FROM aTable");
while($row = mysql_fetch_assoc) {
echo $row['someContent'];
}
我如何在 codeigniter 中执行此操作?
最佳答案
运行查询后,使用 ->query()
或“事件记录”类 ->get()
,使用 result_array
方法。
$query = $this->db->query("SELECT * FROM aTable");
foreach($query->result_array() as $row){
echo $row['someContent'];
}
文档:https://www.codeigniter.com/user_guide/database/results.html
关于php - 如何在 CodeIgniter 中执行 "while fetch assoc"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14406926/