spinn_mit/system/addLike.php

24 lines
385 B
PHP
Raw Normal View History

<?php
2022-11-14 16:27:53 +01:00
require_once('data.php');
?>
<?php
$db = dbVerbindungErzeugen();
$id = $_GET["id"];
$sql = "SELECT likes FROM idee WHERE id = $id";
$resultat = $db->query($sql);
$likeCount = $resultat ->fetchColumn();
$likeCount += 1;
2022-11-14 16:27:53 +01:00
echo ($likeCount);
$sql = "UPDATE idee SET likes=? WHERE id=?";
$stmt = $db->prepare($sql);
2022-11-14 16:27:53 +01:00
$stmt->execute(array($likeCount, $id));
?>