added old project files
This commit is contained in:
36
php/db/getmoviefromdb.php
Executable file
36
php/db/getmoviefromdb.php
Executable file
@ -0,0 +1,36 @@
|
||||
<?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));
|
||||
|
||||
|
||||
|
||||
?>
|
Reference in New Issue
Block a user