// 连接数据库
require './includes/connect.class.php';
$conn = Connect::getInstance();
// 获取数据
$res = $conn->fetchAll("SELECT * FROM `b_sale` UNION ALL SELECT * FROM `b_lend` ");
if (isset($_GET['action']) && $_GET['action'] == 'sale') {
// 按销量排序
array_multisort(array_column($res, 'num'), SORT_ASC, $res);
} elseif (isset($_GET['action']) && $_GET['action'] == 'price') {
// 按价格排序
array_multisort(array_column($res, 'price'), SORT_ASC, $res);
}
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!