PHP database connection class

后端 未结 6 1986
名媛妹妹
名媛妹妹 2020-12-08 05:29

I am trying to get a users ID from a database within a class, but I have very little to no experience with classes, how could I go about getting the uid from the DB and then

6条回答
  •  长情又很酷
    2020-12-08 06:14

    You can use custom database class.
    Code :

    user = "root";
            $this->host = "localhost";
            $this->pass = "";
            $this->db = "db_blog";
        }
        public function connect()
        {
            $link = mysql_connect($this->user, $this->host, $this->pass, $this->db);
            return $link;
        }
    }
    ?>
    

提交回复
热议问题