sending user_info in json
This commit is contained in:
parent
b1f345394e
commit
08d67f19a2
@ -19,17 +19,13 @@ if (!isset($_GET["username"])) return;
|
|||||||
|
|
||||||
$out = $database -> query("SELECT user.username, user.admin, user_info.bio, user_info.nickname, user_info.sex FROM user INNER JOIN user_info ON user.user_info=user_info.id AND username=\"" . $_GET["username"] . "\"");
|
$out = $database -> query("SELECT user.username, user.admin, user_info.bio, user_info.nickname, user_info.sex FROM user INNER JOIN user_info ON user.user_info=user_info.id AND username=\"" . $_GET["username"] . "\"");
|
||||||
|
|
||||||
$sex = array();
|
$output = array();
|
||||||
$sex[0] = "Nespecifikováno";
|
$res = $out -> fetch_assoc();
|
||||||
$sex[1] = "Muž";
|
|
||||||
$sex[2] = "Žena";
|
|
||||||
$sex[9] = "Jiné";
|
|
||||||
|
|
||||||
while ($res = $out -> fetch_assoc())
|
foreach ($res as $key => $value)
|
||||||
{
|
{
|
||||||
echo "Uživatelské jméno: " . $res["username"] . "<br>";
|
$output[$key] = $value;
|
||||||
echo "Přezdívka: " . $res["nickname"] . "<br>";
|
}
|
||||||
echo "Admin: " . ($res["admin"] == 1 ? "Ano" : "Ne") . "<br>";
|
|
||||||
echo "Pohlaví: " . $sex[$res["sex"]] . "<br>";
|
header('Content-type: application/json');
|
||||||
echo "Bio: " . $res["bio"];
|
echo json_encode($output);
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user