php - Using a GET variable that has a apostrophe to pull a text-based field in MySQL table -


possible duplicate:
best way prevent sql injection in php

in code below, field title , variable $submission name in text. query works fine. however, if title , $submission contain apostrophe, query not include results.

how can make query work apostrophes?

$submission = $_get['submission'];  $query2 = "select                title,                 1ad1,                 1adcit,                 1adst,                 zip,                 1adph,                 1site,                 neighborhood                            submission                             title = '$submission'            order                 neighborhood asc";    

you need escape characters special mysql. that's mysql_real_escape_string() required. use on data may contain special characters such apostrophes.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -