码迷,mamicode.com
首页 > 其他好文 > 详细

day04_08-while查询所有行

时间:2017-09-16 11:40:14      阅读:110      评论:0      收藏:0      [点我收藏+]

标签:变量赋值   set   connect   class   host   int   执行   print   logs   

<?php
    $link = @mysql_connect(‘localhost‘,‘root‘,‘‘);
    mysql_query(‘use test‘,$link);
    mysql_query(‘set names utf8‘,$link);
    
    $res = mysql_query(‘select * from user‘);
    //var_dump($res);
    print_r(mysql_fetch_assoc($res));
    
    while($row = mysql_fetch_assoc($res)){
        //print_r(mysql_fetch_assoc($res));//只会打印出偶数行,因为while在前面已经执行过一次,所以需要加上一个变量赋值,如$row;
        print_r($row);//打印数组需要print_r
    }
?>

  

day04_08-while查询所有行

标签:变量赋值   set   connect   class   host   int   执行   print   logs   

原文地址:http://www.cnblogs.com/darkalex001/p/7529926.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!