-
Notifications
You must be signed in to change notification settings - Fork 5
/
orderlist.php
40 lines (37 loc) · 1.01 KB
/
orderlist.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
<?php
session_start();
error_reporting(E_ALL^E_NOTICE);
header('Content-type:text/html;charset=utf-8');
require ('connect.php');
require('islogin.php');
$name=$_SESSION["name"];
$sql="SELECT * FROM `list` where uname='{$name}' ";
$pdo->exec('set names utf8');
$pdo->query('set names utf8');
$rs=$pdo->query($sql);
$result=$rs->fetchAll(PDO::FETCH_ASSOC);
//存入结果 书名 借阅日期
$Jrs=array();
if($result){
foreach($result as $key => $value){
//存入每本书的来时时间和结束时间
$Jrs[$key.'time']=array("begin"=>$value['begin'],
"end"=>$value['end'],
"id"=>$value[b_id],
"totime"=>$value[rest],
);
//存入记录的条数
$Jrs[no]=$key;
$bname='no'.$key.'name';
$getname="SELECT * FROM `book` where b_id=$value[b_id]";
$name=$pdo->query($getname)->fetchAll(PDO::FETCH_ASSOC);
foreach($name as $key => $value){
//存入每次得到的书名
$Jrs[$bname]=$value['b_name'];
}
}
echo json_encode($Jrs);
}else{
echo 0;
}
?>