0
I got 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’s not working, and it also doesn’t show mistakes. Anyone can help?
Puts, hadn’t even paid attention... and why shows no error?
– user77394
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
You have this in your connection code ?– user76271
No, I’ll fix it...
– user77394
Try to use too
try
andcatch
.– user76271
It worked... thank you
– user77394