这个功能应该:
function get_article_info(){
$id = $_GET['id'];
$data = array();
$q = "SELECT * FROM articles WHERE article_id = $id";
$qry = mysql_query($q);
while($row = mysql_fetch_assoc($qry)){
$data[] = $row;
}
return $data;
}
和这个一样:
function get_article_info2(){
$id = $_GET['id'];
$data = array();
$q = mysql_fetch_assoc(mysql_query("SELECT * FROM articles WHERE article_id = $id"));
while($row = $q){
$data[] = $row;
}
return $data;
}
如果我尝试使用 get_article_info2 我会收到此错误:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 35 bytes)
谁能告诉我为什么它不起作用?谢谢 ;)