ganz viel geiler scheiss gemacht!

This commit is contained in:
Marlon Portmann committed 2022-11-14 16:27:53 +01:00
1 parent a3a6cbe329
commit f365ca3592
10 files changed
+249 -35

No files matched your search

+15 -3
View File
@@ -1,11 +1,23 @@
<?php
require_once('data.php');
?>
<?php
$likeCount =
$currentId =
$db = dbVerbindungErzeugen();
$id = $_GET["id"];
$sql = "SELECT likes FROM idee WHERE id = $id";
$resultat = $db->query($sql);
$likeCount = $resultat ->fetchColumn();
$likeCount += 1;
echo ($likeCount);
$sql = "UPDATE idee SET likes=? WHERE id=?";
$stmt = $db->prepare($sql);
$stmt->execute($likeCount, $currentId);
$stmt->execute(array($likeCount, $id));
?>
+3 -1
View File
@@ -5,7 +5,9 @@ require_once('data.php');
<?php
$db = dbVerbindungErzeugen();
$sql = "SELECT * FROM kommentar";
$k_id = $_GET["id"];
$sql = "SELECT * FROM kommentar WHERE idee_id = $k_id";
$resultat = $db->query($sql);
$resultatArray = $resultat ->fetchAll();
echo json_encode($resultatArray);
+10 -4
View File
@@ -7,17 +7,23 @@ require_once('data.php');
$db = dbVerbindungErzeugen();
$lat = $_POST['lat'];
$lng = $_POST['lng'];
if(isset($_POST['titel'])){
$titel = $_POST['titel'];
}
if(isset($_POST['inhalt'])){
$inhalt = $_POST['inhalt'];
if(isset($_POST['text'])){
$inhalt = $_POST['text'];
}
$sql = "INSERT INTO idee (titel, inhalt) VALUES (?, ?)";
$sql = "INSERT INTO idee (titel, inhalt, koordinatenLat, koordinatenLng) VALUES (?, ?, ?, ?)";
$stmt = $db->prepare($sql);
$stmt->execute(array($titel, $inhalt));
$stmt->execute(array($titel, $inhalt, $lat, $lng));
echo $db->lastInsertId();
header("Location: https://751068-4.web.fhgr.ch/");
die();
?>
+22
View File
@@ -0,0 +1,22 @@
<?php
require_once('data.php');
?>
<?php
$db = dbVerbindungErzeugen();
if(isset($_POST['text'])){
$inhalt = $_POST['text'];
}
$id = $_POST['idee_id'];
echo($id);
$sql = "INSERT INTO kommentar (k_text, idee_id) VALUES (?, ?)";
$stmt = $db->prepare($sql);
$stmt->execute(array($inhalt, $id));
?>