您的位置:首页 > 编程语言 > PHP开发

网页 PHP 动态师范

2016-03-13 17:00 519 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0

Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-

transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;

charset=utf-8" />
<script src="../jquery-1.11.2.min.js"></script>
<title>无标题文档</title>
<style type="text/css">
*
{
padding:0px;
margin:0px auto;
font-family:微软雅黑;
}
.cd:hover
{
cursor:pointer;
}
</style>
</head>

<body>

<div style="width:1300px">

<div id="top">
<div id="topleft" style="width:600px;

float:left">

<?php

$code = $_GET["code"];

include("mydbda.php");
$db = new mydbda();

$sql = "select Pic from

ChePic where CarCode = '{$code}'";
$attr = $db->Select

($sql,"CX","guazi");

$sqlcar = "select * from

carinfo where Code = '{$code}'";
$attrcar = $db->Select

($sqlcar,"CX","guazi");

?>

<div style="width:600px; height:400px"><img

src="<?php echo $attr[0][0];?>" style="width:600px;

height:400px"/></div>
<div style="width:600px; height:121px;

margin-top:10px">
<?php

for($i=0;$i<count($attr);$i+

+)
{

echo "<img src='{$attr[$i]

[0]}' style='width:90px; height:60px; margin-

left:5px;' />";
}
?>
</div>
</div>
<div id="topright" style="width:680px;

float:left; margin-left:20px">
<div style="font-size:24px; font-weight:bold;

color:#333;"><?php echo $attrcar[0][1]?></div>
<div style="margin:10px 0px 0px 0px; font-

size:12px;">车源号:<?php echo $attrcar[0][2] ?></div>
<hr style="width:680px; margin:10px 10px 0px

0px;" />
<div style="height:41px; font-

size:12px"><span>车主报价:</span><span style="font-

size:36px; font-weight:bold; color:#ff7e00">¥<?php

echo $attrcar[0][3] ?>万</span><span>新车价(含税)

</span><span style="color:#ff7e00"><?php echo

$attrcar[0][4] ?>万</span><span>, 省</span><span

style="color:#ff7e00"><?php echo $attrcar[0][4]-

$attrcar[0][3] ?>万</span></div>
<div style="font-size:12px; margin-top:10px">

分期付款:首付<span style="color:#ff7e00">3.24万

</span> ,月供<span style="color:#ff7e00">1260元

</span></div>
<div style="font-size:12px; margin-top:10px">

服 务 费:3240元(车价x3%),送1年2万公里质保</div>

<div style="height:44px; width:540px; font-

size:12px; margin:10px 0px 0px 0px">
<div style="width:135px; height:44px;

float:left;">
<div style="font-size:16px; font-

weight:bold"><?php echo $attrcar[0][6] ?></div>
<div>上牌时间</div>
</div>
<div style="width:135px;

height:44px;float:left">
<div style="font-size:16px; font-

weight:bold"><?php echo $attrcar[0][7] ?></div>
<div>里程</div>
</div>
<div style="width:135px;

height:44px;float:left">
<div style="font-size:16px; font-

weight:bold"><?php
if($attrcar[0][8]==0)
{
echo "手动";
}
else if($attrcar[0][8]==1)
{
echo "自动";
}
else
{
echo "手自一体";
}
?></div>
<div>变速箱</div>
</div>

<div style="width:135px;

height:44px;float:left">
<div style="font-size:16px; font-

weight:bold"><?php echo $attrcar[0][9] ?></div>
<div>排放标准</div>
</div>

</div>

<div style="margin-top:10px">
<div style="width:115px; height:48px;

float:left; background-color:#fd8000; text-

align:center; line-height:48px; vertical-

align:middle; color:white; font-size:18px;">预约看车

</div>
<div style="width:115px; height:48px;

float:left; background-color:#fd8000; text-

align:center; line-height:48px; vertical-

align:middle; color:white; font-size:18px;margin-

left:10px">预约看车</div>
</div>

<div style="clear:both"></div>

<div style="margin-top:10px; font-

size:18px;"> <span style="color:#fd8000">看车电话:

</span> <span style=" font-weight:bold"><?php echo

$attrcar[0][10] ?></span></div>

</div>

</div>

<div style="clear:both"></div>

<div style="width:100%; height:48px; border:solid 1px

#ddd; color:#666;font-size:16px;">
<div class="cd" bs="jbxx" style="width:125px;

height:46px; background-color:#22ac38; float:left;

border:solid 1px #ddd; color:white; text-

align:center; line-height:46px; vertical-align:middle

">基本信息
</div>

<div class="cd" bs="cltp" style="width:125px;

height:46px; background-color:#FFF; float:left;

border:solid 1px #ddd; color:#666; text-align:center;

line-height:46px; vertical-align:middle ">车辆图片
</div>

<div class="cd" bs="jcbg" style="width:125px;

height:46px; background-color:#FFF; float:left;

border:solid 1px #ddd; color:#666; text-align:center;

line-height:46px; vertical-align:middle ">检测报告
</div>

<div class="cd" bs="pzcs" style="width:125px;

height:46px; background-color:#FFF; float:left;

border:solid 1px #ddd; color:#666; text-align:center;

line-height:46px; vertical-align:middle ">配置参数
</div>

</div>

<!--基本信息-->
<div class="xq" id="jbxx" style="width:100%;

display:block">
<div style=" margin-top:10px;font-size:16px;

color:#666; font-weight:bold">
<div style="background-color:#22ac38;

height:16px; width:4px;float:left; margin-

right:5px;"></div>
基本信息</div>

<div style="width:100%; font-size:14px;margin-

top:20px">
<div style="width:220px; height:24px;

float:left;margin-right:30px">车主: 王先生| 职员| 顺

义</div>
<div style="width:200px;

height:24px;float:left;margin-right:30px">年检到期:

2017-10</div>
<div style="width:200px;

height:24px;float:left;margin-right:30px">交强险到期:

2016-10</div>
<div style="width:200px;

height:24px;float:left;margin-right:30px">商业险到期:

2016-10</div>
<div style="width:200px;

height:24px;float:left;margin-right:30px">过户次数:

2016-10</div>

</div>
<div style="clear:both"></div>

<div style="width:100%; height:80px; background-

color:#f9f9f9;border:solid 1px #ddd; margin-top:10px;

word-wrap:break-word; word-break:break-all;font-

size:14px; padding:15px 0px 15px 15px;">还拉黑的卡拉哈

里还法拉赫客户</div>

</div>

<!--车辆图片-->
<div class="xq" id="cltp" style="width:100%;

display:none">
<div style=" margin-top:10px;font-size:16px;

color:#666; font-weight:bold">
<div style="background-color:#22ac38;

height:16px; width:4px;float:left; margin-

right:5px;"></div>
车辆图片</div>
<?php

for($i=0;$i<count($attr);$i+

+)
{

echo "<img src='{$attr[$i]

[0]}' style='width:580px; height:400px;

margin:10px;'/>";
}
?>

</div>

<!--检测报告-->
<div class="xq" id="jcbg" style="width:100%;

height:500px; background-color:#63C;

display:none"></div>

<!--配置参数-->
<div class="xq" id="pzcs" style="width:100%;

height:500px; background-color:#FC0; display:none">
</div>

</div>

<script type="text/javascript">
$(document).ready(function(e) {

$(".cd").click(function(){
//所有DIV背景变白,字体变灰色
$(".cd").css("background-

color","#FFF");
$(".cd").css("color","#666");
//自己变绿,字体变白
$(this).css("background-

color","#22ac38");
$(this).css("color","#FFF");

//控制详情显示
var id = $(this).attr("bs");
$(".xq").css

("display","none");
$("#"+id).css

("display","block");

//添加一个自定义属性
$(".cd").removeAttr("xz");
$(this).attr("xz","1");

})

$(".cd").mouseover(function(){

//自己变绿,字体变白
$(this).css("background-

color","#22ac38");
$(this).css("color","#FFF");

})

$(".cd").mouseout(function(){

if($(this).attr("xz") == "1")
{
}
else
{
//变回原形
$(this).css("background-

color","#FFF");
$(this).css("color","#666");
}

})

});
</script>
</body>
</html>


<?php
class mydbda
{
var $host = "localhost";
var $username = "root";
var $password = "123";
var $database = "mydb";

/**
功能:执行SQL语句,返回结果
参数:$sql:要执行的SQL语句
$type:SQL语句的类型

,CX代表查询,QT代表其他
$data:要操作的数据库
返回值:如果是查询,返回结果集
如果是其他语句,执行

成功返回OK,失败返回NO
*/
function Select($sql,$type,$data)
{

//1.造连接对象
$db = new mysqli($this-

>host,$this->username,$this->password,$data);

//2.判断是否连接成功
if(mysqli_connect_error())
{
echo "连接失败";

//退出整个程序
exit;
}
else
{
//4.执行SQL语句

$result = $db->query

($sql);

if($type == "CX")
{
return

$result->fetch_all();
}
else
{
if($result)
{

return "OK";
}
else
{

return "NO";
}
}

}
}

}
?>


mydbda
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: