PHP error: Call to a member function rowCount() on a non-object

后端 未结 3 1774
栀梦
栀梦 2021-01-16 20:20

I\'m working on web app that require a login page, everything work fine but i noticed that when a user try to connect and his password contain caracter he can\'t and an ugly

3条回答
  •  一个人的身影
    2021-01-16 20:39

    The query() function returned something that is not an object.

    You should always check for errors.

    $res = $idconnex->query($req);
    if ( ! $res) {
        echo 'This is not an object:
    '; var_dump($res); die; }

    You should also always read the manual when you run into problems:

    Return Values

    PDO::query() returns a PDOStatement object, or FALSE on failure.

提交回复
热议问题