如上
php如果获取mysql表记录的指定信息呀?
比如想要获取表table的pw_num字段的记录分别为0,11,8,3,9
怎么才能获得字段pw_num里面大于5的值呀?(11,8,9)请高手帮忙解决一下
谢谢

解决方案 »

  1.   


    select * from table where pw_num>5;不太明白lz的意思。
      

  2.   

    ???select * from table where pw_num>5
      

  3.   

    如果想作为一条记录返回:mysql> select * from t;
    +------+--------+
    | id   | pw_num |
    +------+--------+
    |    1 |      0 |
    |    2 |     11 |
    |    3 |      8 |
    |    4 |      3 |
    +------+--------+
    4 rows in set (0.00 sec)mysql> select group_concat(pw_num) from t where pw_num>5;
    +----------------------+
    | group_concat(pw_num) |
    +----------------------+
    | 11,8                 |
    +----------------------+
    1 row in set (0.00 sec)
      

  4.   

    关于php应用,对于mysql数据库,语句为:
    $sql=mysql_query("select pw_num from tablename order by pw_num  desc",$conn);
    //$conn是数据库连接
    while($info=mysql_fetch_array($sql))
                         {
                              echo $info[pw_num];
                         }
      

  5.   

    楼主是找这个的函数吧?
    group_concat(pw_num)
    三楼正解
      

  6.   

    +----------+---------------------+------+
    | username | usertime            | type |
    +----------+---------------------+------+
    |          | 2009-10-15 09:48:12 | 0    | 
    | 456      | 2009-10-14 20:30:07 | 1    | 
    | 789      | 2009-10-14 20:30:32 | 2    | 
    | 99       | 2009-10-15 10:36:55 | 1    | 
    | 333      | 2009-10-15 10:39:38 | 1    | 
    | 888      | 2009-10-15 10:34:11 | 0    | 
    +----------+---------------------+------+