Maison > Article > développement back-end > PHP如何查询SQL加载变量的表
PHP如何查询SQL加载变量的表如下图
选择线路
选择不同的线路加载不懂得表
原句是这个,
$q="SELECT * FROM `line` LEFT JOIN research2 on line.busname = research2.busname WHERE banben is NULL or banben like '%{$_REQUEST['banben']}%'";
根据原句修改后报错
$q="SELECT * FROM `'%{$_REQUEST['xianlu']}%'` LEFT JOIN research2 on '%{$_REQUEST['xianlu']}%'.busname = research2.busname WHERE banben is NULL or banben like '%{$_REQUEST['banben']}%'";
$q="SELECT * FROM `{$_REQUEST['xianlu']}` LEFT JOIN research2 on `{$_REQUEST['xianlu']}`.busname = research2.busname WHERE banben is NULL or banben like '%{$_REQUEST['banben']}%'";