An error occurred while loading the file. Please try again.
-
Arya Pradipta authored
getBerita.php 868 B
<?php
/**
* PHP Version 7
* Mengambil konten berita dengan id.
* @category Berita
* @package Komunitas-PMO
* @author Putu Arya Pradipta <13515017@std.stei.itb.ac.id>
* @license http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
* @link http://pear.php.net/package/komunitas-pmo
*/
require 'dbConnect.php';
header('Content-Type: application/json');
// error_reporting(E_ALL);
// ini_set('display_errors', 1);
$id = (int)$_GET["id"];
$stmt = $conn->query("SELECT * FROM `berita` WHERE `id` = " . $id);
// echo $id;
// $id = 80;
// $stmt->bind_param("i",$id);
// echo $stmt->errno;
// $stmt->execute();
// $count = $stmt->num_rows;
$row = $stmt->fetch_assoc();
$temprow = json_decode($row["foto"], true);
$row["foto"] = $temprow;
// while() {
// $res[] = $row;
// }
echo json_encode($row, JSON_PRETTY_PRINT);
$stmt->close();
$conn->close();