2013-08-25 21:04
浏览 33


I have a loop that never ends and its only pulling one record from the database.

I have a class that returns a list then I call that class function on a website where the while loop never stops echoing the data.

class exampleclass
public function get_list()
$query = $dbh->prepare("SELECT .. blah);
return $query->fetch(PDO::FetchObj);

on the web page i have:

testobj = new exampleclass();
while ($obj = $testobj->get_list())
echo $obj->db_field;

It pulls the one record from the database but it doesn't stop looping, it should just loop once.

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题