我使用具有 6 个标准的 html 表单,$_POST
在变量中使用 lat 的转换标准,如下所示:
案例 1 - 所有条件都是默认
$core = null; $mhz = null; $ram = null; $cam = null; $mAh = null $screen = null
的正确的 sql 查询是这样的:
$sql = "SELECT * FROM $tbl_name ORDER BY performanta_cpu_core DESC, performanta_cpu DESC, performanta_rami DESC LIMIT $start, $limit";
案例 2 - 仅设置一个条件
$core = null; $mhz = "performanta_cpu=1400"; $ram = null; $cam = null; $mAh = null $screen = null
正确查询是这样的:
$sql = "SELECT * FROM $tbl_name WHERE $mhzz ORDER BY performanta_cpu_core DESC, performanta_cpu DESC, performanta_rami DESC LIMIT $start, $limit";
案例 3 - 这是设置的所有或多个标准的问题:
$core = 2; $mhz = "performanta_cpu=1400"; $ram = "performanta_rami=1024"; $cam = "camera_spate=3.2"; $mAh = "baterie_mAh=2250"; $screen = "densitate=441";
我知道我需要在WHERE
设置任何变量时使“”成为动态和可见的,并且我还需要一个“ AND
”也动态地像:
$sql = "SELECT * FROM $tbl_name WHERE $core AND $mhzz ORDER BY performanta_cpu_core DESC, performanta_cpu DESC, performanta_rami DESC LIMIT $start, $limit";
我为此压力了一个星期,没有帮助我无法前进......
提前致谢