注册和登录方面的困难

时间:2017-11-15 06:19:17

标签: javascript php mysql

以下是代码:

include_once('class.database.php'); 

class ManageUsers{
    public $link;

    function __construct(){
        $db_connection = new dbConnection();
        $this->link = $db_connection->connect();
        return $this->link;
    }

    function registerUsers($password, $ip_address, $date, $time, $username, $email, $uname){
        $query = $this->link->prepare("INSERT INTO users (password,ip_address,date,time,username, email, uname) VALUES(?,?,?,?,?,?,?)");
        $values = array ($password, $ip_address, $date, $time, $username, $email, $uname);
        $query->execute($values);
        $count = $query->rowCount();
        return $count;
    }

    function LoginUsers($username, $password){
        $query = $this->link->query("SELECT * FROM users WHERE username='$username' AND password='$password'");
        $rowCount = $query->rowCount();
        return $rowCount;
    }
    function GetUserInfo($username){
        $query = $this->link->query("SELECT * FROM users WHERE username = '$username'");
        $rowCount = $query->rowCount();
        if($rowCount ==1)
        {
            $result = $query->fetchAll();
            return $result;
        }
        else
        {
            return $rowCount;
        }
    }

}

它显示了我的错误

  

致命错误:在非对象中调用成员函数query()   第22行的C:\ wamp \ www \ timetable \ class.ManageUsers.php

0 个答案:

没有答案