php - mysql_query where statement -


I am retrieving prices with the GET method from the URL and then if they set an I statement Ask them if they are using only to display those items against the database, which match them, I get an unknown error with your request. Here is my code.

  $ province = $ _GET ['province']; $ City = $ _GET ['city']; If (isset ($ province) & amp; amp; and isset ($ city)) {$ result3 = mysql_query ("Select SELECT * Normal to WHERE province = $ province and city = $ city") or die ("your An unknown error occurred with unknown request "); } And {$ results3 = mysql_query ("Select * FROM generalinfo"); } / * If the question ends / /  

You need a single-quotation SQL:

  "SELECT * FROM generalinfo WHERE province = '$ province' and city = '$ city'"  

Note that the query Instead of using the way you build a SQL injection vulnerability, consider using instead.

"SELECT * FROM generalinfo WHERE province = '". Mysql_real_escape_string ($ province) "'and city ='". Mysql_real_escape_string ($ city). "'"

Comments