怎么将数据库信息用php存入数组当中

WBOY
Release: 2016-06-13 13:11:01
Original
1434 people have browsed it

如何将数据库信息用php存入数组当中
$conn=mysql_connect('localhost','root','');
 $selectdb=mysql_select_db("career",$conn);
// mysql_query("set names 'gbk'");
 $result=mysql_query("SELECT acode FROM code");
$row= mysql_fetch_array($result,MYSQL_NUM);
while($row)
{
  for($i=0;$i   {
  echo $row[$i];
  }
}

我打算将数据库中的一个列存入数组中但是输出的结果却只输出了$row[0]的内容,后面的都不存在,好像问题在mysql_fetch_array 我使用print_R输出$row时里面就只存在一个$row[0]请问怎样才能完整的将数据库的一个列存入数组当中

我的数据库中有id有2041个





------解决方案--------------------
while($row= mysql_fetch_array($result,MYSQL_NUM))

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!