Home >Backend Development >PHP Tutorial >PHP怎么查询SQL加载变量的表

PHP怎么查询SQL加载变量的表

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:07:41985browse

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']}%'"; 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn