1
0
mirror of https://github.com/Foltik/Shimapan synced 2024-11-28 05:26:44 -05:00

Update usage of rowCount() to fetchColumn()

This commit is contained in:
Foltik 2016-08-14 20:44:31 -04:00
parent 51b5d26f09
commit 63667a5d0d

View File

@ -16,7 +16,7 @@ function register($user, $pass, $code)
$q->prepare("SELECT user FROM accounts WHERE user = (:user)"); $q->prepare("SELECT user FROM accounts WHERE user = (:user)");
$q->bindParam(':user', $user); $q->bindParam(':user', $user);
$q->execute(); $q->execute();
if ($q->rowCount == 0) { if ($q->fetchColumn() == 0) {
// Add new account // Add new account
$q = $db->prepare("INSERT INTO accounts (user, pass, level, apikey) VALUES (:user, :pass, :level, :apikey)"); $q = $db->prepare("INSERT INTO accounts (user, pass, level, apikey) VALUES (:user, :pass, :level, :apikey)");
$q->bindParam(':user', $user); $q->bindParam(':user', $user);
@ -208,7 +208,7 @@ function report($file, $reason)
$q->execute(); $q->execute();
$result = $q->fetch(); $result = $q->fetch();
if ($q->rowCount() != '0') { if ($q->fetchColumn() != '0') {
$q = $db->prepare("INSERT INTO reports (hash, date, file, fileid, reporter, reason) VALUES (:hash, :date, :file, :fileid, :reporter, :reason)"); $q = $db->prepare("INSERT INTO reports (hash, date, file, fileid, reporter, reason) VALUES (:hash, :date, :file, :fileid, :reporter, :reason)");
$q->bindValue(':file', strip_tags($file)); $q->bindValue(':file', strip_tags($file));
$q->bindValue(':date', date('Y-m-d')); $q->bindValue(':date', date('Y-m-d'));