$rs=mysql_fetch_object($result)  然后可以这么定义变量吗?$id = $rs->post_id;

解决方案 »

  1.   

    <?php
    mysql_connect("hostname", "user", "password");
    mysql_select_db("mydb");
    $result = mysql_query("select * from mytable");
    while ($row = mysql_fetch_object($result)) {
        echo $row->user_id;
        echo $row->fullname;
    }
    mysql_free_result($result);
    ?> 
      

  2.   


    确定吗? 为什么我定义$id=$rs->post_id;
    echo $id 就没有结果呢?
      

  3.   

    确定$rs  不为 null吗