<?php
require_once '../dbconfig.php';
if (isset($_POST)) {
$post_id = $_POST["id"];
$title = trim($_POST['title']);
$post_link = str_replace(" ", "_", strtolower(trim($_POST['title'])));
$img = $_POST['img'];
$text = trim($_POST['text']);
$chords = trim($_POST['chords']);
$SC = trim($_POST["linkSC"]);
$poster = trim($_SESSION["user_name"]);
$dt = date('Y-m-d H:i:s');
$isupdated = 1;
$links = json_decode($_POST["links"], true);
try {
$stmt = $db_con->prepare("UPDATE `PJW_posts` SET title=?, post_link=?, img=?,text=?, sc_link=?, chords=?, updated_by=?, updatetime=?, is_updated=? WHERE id=?");
if ($stmt->execute(array($title, $post_link, $img, $chords, $SC, $chords, $poster, $dt, $isupdated, $post_id))) {
echo json_encode(["status" => 200]);
exit;
} else {
echo json_encode(["status" => 422, "error" => "Database error."]);
}
} catch (PDOException $e) {
echo json_encode(["status" => $e->getCode(), "error" => $e->getMessage()]);
}
}
preferences:
55.69 ms | 402 KiB | 5 Q