Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- signup class:
- function __construct() {
- require 'db.php';
- $this->db = new db();
- }
- public function checkDuplicate($email) {
- $this->db->connect();
- $q = $this->db->conn->query("SELECT email FROM table WHERE email = $email");
- return (($q->rowCount() > 0) ? true : false);
- }
- db.php:
- class db {
- public function __construct() {
- $this->dsn = 'mysql:host=127.0.0.1;port=3306;dbname=fb';
- $this->user = 'root';
- $this->password = '';
- }
- public function connect(){
- try {
- $this->conn = new PDO($this->dsn, $this->user, $this->password);
- } catch (PDOException $e) {
- header('Location: /sdfa/signup.php?dbError');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement