<?php
$key_tel=$_GET['tel'];
// print_r($key_tel);
if(empty($key_tel)){echo "请输入维修下单时留存的手机号码!";}
else{
try {
$pdo = new PDO("mysql://127.0.0.1:3306=localhost;dbname=ryhengdeli","root","123456");
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
$pdo->query('set names utf8;');//设置编码 或者 $conn->set_charset("utf8");
$id_sql = "select id,name from t_customer where mobile=".$key_tel."";
// print_r($pdo->query($id_sql));
$id_result = $pdo->query($id_sql);
// print_r($id_result);
$id_rows = $id_result->fetch(PDO::FETCH_ASSOC);//数据集合,从结果集中获取以列名为索引的关联数组
$id_key = $id_rows["id"];
$name_key = $id_rows["name"];
// print_r($id_key);
$tl_sql = "select * from t_customer_timeline where customerId=".$id_key."";
$tl_result = $pdo->query($tl_sql);
if(false!==$tl_result)
{
$tl_rows = $tl_result->fetchALL();//数据集合
// print_r($tl_rows);
}
else{echo "无此手机号维修单据，请核实!";}
}
?>

<html>
<head>
<meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0,user-scalable=no">
<meta charset="utf-8">
<meta name="renderer" content="webkit">
<title> 维修订单进度</title> 
</head>
<body>

<?php if(false!==$tl_result):?>
<p>

<b>
<font size="+3" >
<?php echo $name_key;?></font></b>，您好！<br/>
您的维修单进展如下</p>
<p>
<font size="+1" >
***********维修订单详情***********
</font>
<ol>
<?php foreach($tl_rows as $r):?>
<li><b><?php echo $r['name'];?></b><?php echo $r['_createDate'];?><br/><?php echo $r['_systemRemark'];?></li>
<?php endforeach;?>
</ol>
<?php else:?>
<?php endif;?>
<p>

<font size="+1" >
***********维修订单详情***********
</font><br/>
<b>
<font size="+3" >
老亨达利钟表维修中心</font></b>

</p>
</body>
</html>