Home > Backend Development > PHP Tutorial > 求问这条话语是否可行

求问这条话语是否可行

WBOY
Release: 2016-06-13 12:48:45
Original
823 people have browsed it

求问这条语句是否可行!

SELECT * FROM city WHERE city.pname=$row_a['pname']
Copy after login
$row_a['pname']为另一个表格的变量,求问这条句语可行否,如果出错,错在哪


------解决方案--------------------
你那个$row_a['pname']是从PHP程序中传来的吧,改成这样就能执行了,大概
<br />
$sql="SELECT * FROM city WHERE city.pname='$row_a['pname']";<br />
$result=mysql_query($sql);<br />
Copy after login


如果单纯用MYSQL,则需要把$row_a['pname']换成特定的值,如
SELECT * FROM city WHERE city.pname='A'

Related labels:
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