123456789101112131415161718192021222324252627 |
- <?php
- header('Content-type:text/html;charset=utf-8');
-
- $cid = $_GET['cid'];
-
- $link = mysqli_connect('localhost', 'shenzhenmayi', 'w82q5bmy', 'shenzhenmayi');
- if(!$link){
- exit('数据库连接失败!');
- }
-
- $n = 0;
- $arr = array();
-
- $sql = "SELECT * FROM ey_archives WHERE typeid = 2 && city_id = $cid LIMIT 5";
- $res = mysqli_query($link, $sql);
- while($row = mysqli_fetch_array($res)){
- $arr[0][$n] = $row['aid'];
- $arr[1][$n] = $row['title'];
- $arr[2][$n] = date('Y-m-d', $row['add_time']);
- $n++;
- }
-
- echo json_encode($arr);
-
- mysqli_free_result($res);
- mysqli_close($link);
- ?>
|