How to store database information in an array using php

Source: Internet
Author: User
How to store database information in the array with php $ conn = mysql_connect ('localhost', 'root', ''); & nbsp; $ selectdb = mysql_select_db (& quot; career & quot;, $ conn); // How does mysql_quer store database information in an array using 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 <= count ($ row)-1; $ I ++)
{
Echo $ row [$ I];
}
}

I plan to store a column in the database into an array, but the output result only outputs the content of $ row [0], which does not exist at the end, it seems that the problem is that only one $ row [0] exists in mysql_fetch_array when I use print_R to output $ row. how can I fully store a column in the database into an array?

I have 2041 IDs in my database





------ Solution --------------------
While ($ row = mysql_fetch_array ($ result, MYSQL_NUM ))

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.