请问个有关问题 mysql记录集不支持movenext方法吗

WBOY
Release: 2016-06-13 11:55:25
Original
1121 people have browsed it

请教个问题 mysql记录集不支持movenext方法吗
 function GetTags($device)
{
  $sql = "select tagname from TagList where device='$device'"; 
  $rs = mysql_query($sql); 
  while(! $rs->eof)   //将记录集存储到二维数组
 {   
         $tags[] = array('tagname'=>$rs->fields['tagname']->value);
         $rs->MoveNext();
   }
   return $tags;
   mysql_free_result($rs); //关闭数据集
}
为什么我在php查询mysql数据库,操作记录集时使用movenext方法一直报错no-object?难道mysql记录集不支持这个方法吗,那该如何实现?另外循环里的数组$tags在循环外能正确返回吗?
我想将记录集存储到数组,并返回这个数组,请高手给看看!
------解决方案--------------------

本帖最后由 xuzuning 于 2014-04-18 15:56:49 编辑 是的,不支持
while($row = mysql_fetch_assoc($rs))   //将记录集存储到二维数组<br />{ <br />    $tags[] = $row;<br />}
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!