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

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

WBOY
Release: 2016-06-23 13:47:52
Original
768 people have browsed it

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

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template