首页上一页 1 下一页尾页 1 条记录 1/1页
我想改变查询表的car_road,改为查询car_number 有错误
发表在PHP图书答疑
2019-05-05 悬赏:3 学分
《PHP项目开发全程实录(第3版)》第5章 物流配送信息网(Apache+PHP+phpMyAdmin+MySQL 5.0实现)
是否精华
是
否
版块置顶:
是
否
$query_all = "select count(*) from tb_car where car_road like '%$start%' and car_road like '%$end%' "; $result = $pdo->prepare($query_all); $result->execute(); $total = $result->fetchColumn(); $pages = pages($total,$page,$pageSize,$show); // 调用分页方法 /** 筛选数据 **/ $query = "select tb_car.*,tb_car_log.car_log from tb_car left join tb_car_log on tb_car_log.car_number = tb_car.car_number "; $query .= "where car_road like '%$start%' and car_road like '%$end%' order by id desc limit {$offset},{$pageSize} "; $res = $pdo->prepare($query); $res->execute();
改为
$query_all = "select count(*) from tb_car where car_number like '%$start%' ";
//and car_road like '%$end%'
$result = $pdo->prepare($query_all);
$result->execute();
$total = $result->fetchColumn();
$pages = pages($total,$page,$pageSize,$show); // 调用分页方法
/** 筛选数据 **/
$query = "select tb_car.*,tb_car_log.car_log from tb_car left join tb_car_log on tb_car_log.car_number = tb_car.car_number ";
$query .= "where car_number like '%$start%' order by id desc limit {$offset},{$pageSize} ";
//and car_road like '%$end%'
$res = $pdo->prepare($query);
$res->execute();
?>