Home  >  Article  >  Backend Development  >  PHP如何查询SQL加载变量的表

PHP如何查询SQL加载变量的表

WBOY
WBOYOriginal
2016-06-23 13:47:52700browse

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