-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathver_usuarios.php
44 lines (35 loc) · 1.09 KB
/
ver_usuarios.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
include("conexion.php");
if (mysqli_connect_errno()) {
printf("Error de conexion: %s\n", mysqli_connect_error());
exit();
}
$return = Array("array");
if ($result = $mysqli->query("select Nombre from menu WHERE Tipo='sopa' ORDER BY RAND() LIMIT 1")){
while ($row = $result->fetch_row()) {
array_push($return, 'sopa', $row[0]);
}
$result->close();
}
if ($result = $mysqli->query("select Nombre from menu WHERE Tipo='guiso' ORDER BY RAND() LIMIT 1")){
while ($row = $result->fetch_row()) {
array_push($return, 'guiso', $row[0]);
}
$result->close();
}
if ($result = $mysqli->query("select Nombre from menu WHERE Tipo='agua' ORDER BY RAND() LIMIT 1")){
while ($row = $result->fetch_row()) {
array_push($return, 'agua', $row[0]);
}
$result->close();
}
if ($result = $mysqli->query("select Nombre from menu WHERE Tipo='postre' ORDER BY RAND() LIMIT 1")){
while ($row = $result->fetch_row()) {
array_push($return, 'postre', $row[0]);
}
$result->close();
}
$res=$res.json_encode($return)."\n";
echo $res;
$mysqli->close();
?>