2022-10-27 17:33:19 +02:00
|
|
|
<?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-10-27 17:33:19 +02:00
|
|
|
|
2022-11-14 16:27:53 +01:00
|
|
|
echo ($likeCount);
|
2022-10-27 17:33:19 +02:00
|
|
|
|
|
|
|
$sql = "UPDATE idee SET likes=? WHERE id=?";
|
|
|
|
$stmt = $db->prepare($sql);
|
2022-11-14 16:27:53 +01:00
|
|
|
$stmt->execute(array($likeCount, $id));
|
2022-10-27 17:33:19 +02:00
|
|
|
|
|
|
|
|
|
|
|
?>
|