Database data is inserted randomly.-php Tutorial

Source: Internet
Author: User
The database data is dynamically inserted into an array randomly... waiting for online !!! At last, this post was edited by mahuatengBC from 2013-01-0911: 35: 57 to allow static write operations. However, I tried multiple methods dynamically... expert guidance ha $ totleArrarray (); $ totleArr & nbsp; array_merge (array_fill (database data is dynamically inserted randomly into the array... urgent online, etc !!!

This post was last edited by mahuatengBC at 11:35:57 on

Static data can be written, but dynamic data cannot be written after N methods are tried...
Expert guidance

$ TotleArr = array ();
$ TotleArr = array_merge (array_fill (0, 20, "ipad mini"), array_fill (0, 50, "Radio pressure cooker"), array_fill (0, 80, "Satan"), array_fill (0, 9850, "not winning "));

This is static code and can be implemented as required...


But how can we replace it with dynamic database data?


------ Solution --------------------
$ TotleArr = array ();
While ($ row = mysql_fetch_array ($ rs ))
{
$ TotleArr = array_merge (array_fill (0, $ row ['rate'], $ row ['name']);
}

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.