数据库数据动态随机插入数组.

WBOY
Release: 2016-06-13 11:10:12
Original
922 people have browsed it

数据库数据动态随机插入数组...急在线等!!!

本帖最后由 mahuatengBC 于 2013-01-09 11:35:57 编辑 静态的可以写,但是动态的试了N多方法 就是不行...
高手指点指点哈

$totleArr=array();<br />$totleArr = array_merge(array_fill(0, 20, "ipad mini"), array_fill(0, 50, "无线电压力锅"), array_fill(0, 80, "撒旦撒旦"), array_fill(0, 9850, "未中奖"));
Copy after login

这是静态的代码,可以实现要求...


但是怎么换成动态的数据库数据呢?


------解决方案--------------------
$totleArr = array();<br />while($row=mysql_fetch_array($rs))<br />{<br />  $totleArr = array_merge(array_fill(0, $row['rate'], $row['name']));<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!