-
Notifications
You must be signed in to change notification settings - Fork 0
/
categories.php
49 lines (37 loc) · 896 Bytes
/
categories.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
44
45
46
47
48
49
<?php
ini_set('display_errors', '1');
$category = $_POST["category"];
//echo $category;
include_once("config.inc.php");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
else
{
$sql_query1 ="
SELECT *
FROM `top_free_apps`
WHERE genre = '".$category."'
LIMIT 0 , 5
";
$sql_query2 ="
SELECT *
FROM `top_paid_apps`
WHERE genre = '".$category."'
LIMIT 0 , 5
";
$result1=mysqli_query($con,$sql_query1);
$result2=mysqli_query($con,$sql_query2);
$data1 = [];
$data2 = [];
while ($row = $result1->fetch_assoc()) {
$data1[] = $row;
}
while ($row = $result2->fetch_assoc()) {
$data2[] = $row;
}
$join_row = array_merge($data1,$data2);
//$rows=mysqli_fetch_all($result,MYSQLI_NUM);
echo json_encode($join_row);
}
?>