<?php
$servername = "localhost";
$username = "puntaiji_shit";
$password = "ห้ระหีพำืขะฟพนะ";
$database = "puntaiji_shitsuren";
$res = "";
$link = mysqli_connect($servername, $username, $password,$database);
if (!$link)
{
$output = 'Unable to connect to the database server.';
echo $output;
exit();
}
mysqli_set_charset($link, "utf8");
if(count($id) > 0){
$sql = "SELECT * FROM tarot WHERE card_id IN (";
for ($x = 0; $x < count($id); $x++) {
$sql .= "'".$id[$x]."'";
if($x < count($id)-1){
$sql .= ",";
}
}
$sql .= ")";
$sql .= " ORDER BY FIELD( card_id,";
for ($x = 0; $x < count($id); $x++) {
$sql .= "'".$id[$x]."'";
if($x < count($id)-1){
$sql .= ",";
}
}
$sql .= ");";
if($result = mysqli_query($link, $sql)){
$res = array();
while($row = mysqli_fetch_assoc($result)){
array_push($res,$row);
}
mysqli_free_result($result);
}
echo(json_encode($res));
}
mysqli_close($link);
?>
?>
