@ebutt13
The check_user_exists() method works fine but the new_user() method doesn't insert anything into the database or return an error of any kind. Does anybody know what I might be doing wrong?
Can you post how you connect to the db using PDO.
This seems wrong:
$stmt = $this->_db->prepare("INSERT INTO client_login(Client_ref,Username,Password) VALUES(?,?,?)");
It should look like this:
$stmt = $db->prepare("INSERT INTO client_login(:Client_ref,Username,Password) VALUES('?','?','?')");
LastMitch
Industrious Poster
4,374 posts since Mar 2012
Reputation Points: 149
Solved Threads: 350
Skill Endorsements: 47
As I said, the other SQL queries work, so I don't think it's a problem with the connection.
The reason why I ask because I need to see what is _db? If you establish your $pdo as the connection then it should be
$pdo = new PDO('mysql:host=localhost;dbname=contisec_portal', 'root', '');
So this should appear like this:
Then on line 4:
$stmt = $pdo->prepare('SELECT * FROM client_login WHERE Username = ?');
Then on line 16:
$stmt = $pdo->prepare("INSERT INTO client_login(Client_ref,Username,Password) VALUES(?,?,?)");
Then on line 22:
$stmt->execute(array($Client_ref,$Username,$Password));
or
you can leave it alone and just add the array in the execute:
Then on line 4:
$stmt = $this->_db->prepare('SELECT * FROM client_login WHERE Username = ?');
Then on line 16:
$stmt = $this->_db->prepare("INSERT INTO client_login(Client_ref,Username,Password) VALUES(?,?,?)");
Then on line 22:
$stmt->execute(array(_Client_ref,_Username,_Password));
LastMitch
Industrious Poster
4,374 posts since Mar 2012
Reputation Points: 149
Solved Threads: 350
Skill Endorsements: 47