This repository has been archived on 2022-02-10. You can view files and clone it, but cannot push or open issues or pull requests.
titama/res/php/get_course.php

20 lines
453 B
PHP
Raw Normal View History

2015-10-21 10:47:50 +02:00
<?php
if (!isset($_GET['id'])) {
echo "No id given!";
return;
}
$id = $_GET['id'];
include './config.php';
$conn = new mysqli($dbhost, $dbuser, $dbpassword, $dbname);
if ($conn->error) {
die("Failed to connect to the database: " . $conn->error);
}
$sql = "SELECT * FROM Titama WHERE id=$id";
$res = $conn->query($sql);
if ($res->num_rows > 0) {
$course = $res->fetch_assoc();
echo json_encode($course);
}
include './closedb.php';
?>