resource id #4 Why am I getting this?

后端 未结 5 840
感动是毒
感动是毒 2020-12-11 20:51

I have a pretty basic forum template I am working on for testing purposes

When I create a topic, and press submit, the proccess updates the database but doesn\'t out

5条回答
  •  佛祖请我去吃肉
    2020-12-11 21:15

    You are getting resource id #4 because $result is an resource,you must extract the values contained in it by this way,

    $result=mysql_query($sql);
    $values = mysql_fetch_array($result);
    var_dump($values);
    

    More about resource variable

    Update 2(From OP comments)

    You are printing values using field name,In that case you will have to change to

    while($rows=mysql_fetch_array($result,MYSQL_ASSOC))
    

    Or you can directly use mysql_fetch_assoc(),which in your case will be

    while($rows=mysql_fetch_assoc($result)){
          echo $rows['id'];
    }
    

提交回复
热议问题