Начат запил страницы отображающей пост

This commit is contained in:
2024-04-27 20:47:41 +03:00
parent 62b7b68976
commit e538a76b09
9 changed files with 237 additions and 17 deletions

View File

@@ -41,12 +41,10 @@ function Post_AddView (int $id): ReturnT {
global $db;
$s = $db->prepare("UPDATE posts SET views = views + 1 WHERE id = ?");
$s->bind_param("s", $id);
$s->execute();
$d = $s->get_result()->fetch_assoc();
$s->bind_param("i", $id);
if (!(bool)$d)
return new ReturnT(err_code: E_UIN_WRONGID, err_desc: "failed to increment number of views");
if (!$s->execute())
return new ReturnT(err_code: E_DBE_UNKNOWN, err_desc: "failed to execute statement");
return new ReturnT(data: true);
}