HomeMediacenter/php/db/getmoviefromdb.php

37 lines
758 B
PHP
Raw Normal View History

2020-05-16 18:41:32 +00:00
<?php
$server = "172.17.0.2";
$user = "mediacenter";
$password = "w3xSBWWqvBFaLzmC";
$database = "mediacenter";
$data = new class{};
$link = new mysqli($server, $user, $password,$database);
if(mysqli_connect_errno())
{
echo "connecton failed... nr: ". mysqli_connect_errno(). " -- " . mysqli_connect_error();
}
if (isset($_POST['action'])) {
$action = $_POST['action'];
if ($action == "all") {
$query = "SELECT * FROM `movies`";
$result = mysqli_query($link,$query);
$resultnumber = $result->num_rows;
$data->data = array();
while($row = $result->fetch_assoc()) {
array_push($data->data, array('name' => $row['name'],'url' => $row['URL'],'thumbnail' => $row['thumbnail'] ));
}
}
}
echo(json_encode($data));
?>