您的位置:首页 > 编程语言 > PHP开发

PHP 列出数据库中数据

2017-01-01 19:22 183 查看
php列出数据库中数据

<?php
$row = $rows = array();
$sql=mysql_query("SELECT * FROM shouzhi ORDER BY shouzhi_time DESC");
$total = mysql_num_rows($sql);
while($row = mysql_fetch_array($sql) ){
$rows[]=$row;
}
/* print_r($rows);
echo '<hr>';
for ($i=$total-1; $i<$total & $i>=0; $i--){
echo date('ym',strtotime('-1 month' .$rows[$i]['shouzhi_riqi'])).',';
echo $rows[$i]['shouzhi_shou'].',';}
echo '<hr>';
echo $rows['0']['shouzhi_riqi'].$rows['0']['shouzhi_yu'];
echo $total; */
?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  php mysql for while