Reduce the sql request
This commit is contained in:
parent
39d4be9eb3
commit
dbf62c88bd
1 changed files with 2 additions and 11 deletions
13
db.php
13
db.php
|
@ -95,20 +95,11 @@ class DataBase
|
|||
while($data = $stmt->fetch()) {
|
||||
if ($this->areWordsSimilar($data['word'], $word)) {
|
||||
$word = $data['word'];
|
||||
$wordId = $data['id_word'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
$stmt = $this->db->prepare("
|
||||
SELECT *
|
||||
FROM words
|
||||
WHERE cloud_id = :cid
|
||||
AND word = :w;
|
||||
");
|
||||
$stmt->bindValue(':cid', $cloudId, PDO::PARAM_INT);
|
||||
$stmt->bindValue(':w', $word, PDO::PARAM_STR);
|
||||
$stmt->execute();
|
||||
if ($data = $stmt->fetch()) {
|
||||
$wordId = $data['id_word'];
|
||||
if (isset($wordId)) {
|
||||
$stmt = $this->db->prepare("
|
||||
UPDATE words
|
||||
SET count = count + 1
|
||||
|
|
Loading…
Reference in a new issue