Insert class in PHP does not work and shows no error

0

I have the following code in php :

<?php

class Users extends DB {

    private function verifyUser($email) {
        $select = self::conn()->prepare("SELECT * FROM 'users' WHERE email = '{$email}'");
        $select->execute();

        if ($select->rowCount() >= 1) {
            return true;
        } else {
            return false;
        }
    }

    public function insertUser($data = array()) {
        if ($this->verifyUsers($data[2])) {
            return false;
        } else {
            $insert = "INSERT INTO 'users' (email) VALUES (?,?,?)";
            $stmt = self::conn()->prepare($insert);

            if ($stmt->execute($data)) {
                return true;
            } else {
                return false;
            }
        }
    }
}

It is not working, nor does it show errors . Can anyone help?

    
asked by anonymous 22.05.2017 / 17:24

1 answer

0

Notice your% of%

The name of the method you defined is as verifyUser

And in private function verifyUser($email){} you are checking a method that does not exist, please note, your method is verifyUser you are using verifyUsers with s strong> ". It will never really work.

Also switch: public function insertUser($data = array()){} users $insert = "INSERT INTO

By: (email) VALUES (?,?,?)"; users $insert = "INSERT INTO

You do not need 3 "?"

Note: Use array (email) VALUES (?)"; in [2]

    
22.05.2017 / 17:27