Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource

前端 未结 4 560
遇见更好的自我
遇见更好的自我 2021-01-22 12:50

Hell there when i try and connect to pull thing out of the database i get the following error:

Warning: mysql_fetch_object(): supplied argument is not a valid My         


        
4条回答
  •  日久生厌
    2021-01-22 13:01

    $sql = "GET * FROM matt";
    

    is wrong. Correct SQL syntax is

    $sql = "SELECT * FROM matt";
    

    That error is passed into

    $result = mysql_query($sql,$con);

    which then is invalid and can't be used in while($row = mysql_fetch_object($result)).

    You should check for mysql_error() after mysql_query() to catch these.

提交回复
热议问题