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

求问这条话语是否可行

WBOY
WBOYOriginal
2016-06-13 12:48:45759browse

求问这条语句是否可行!

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


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


如果单纯用MYSQL,则需要把$row_a['pname']换成特定的值,如
SELECT * FROM city WHERE city.pname='A'
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
Previous article: php 如何输出复选框呢 Next article: PHP 处置图片