-1

I have in my table some name having ' in them example Paul's Ricore when performing a search example

http://www.website.com?s=paul's ricore

i get a page with mysql error mysql_fetch_assoc() expects parameter 1 to be resource, but if i just place \ all is ok.

example http://www.website.com?s=paul\'s ricore.

I want to provide a link for that example

<a href=\"http://www.website.com/?s=". $row['Placename'] .".html\">"

Any solution for name with the ' is them

meandme
  • 2,467
  • 2
  • 18
  • 20
  • Have you got some code ? But I think you should use mysql_real_escape_string http://php.net/manual/fr/function.mysql-real-escape-string.php – kmas Sep 25 '13 at 09:51

2 Answers2

3

You should escape the values when you are querying the database
(see http://php.net/manual/en/mysqli.real-escape-string.php for more information)

and you should also urlencode the URLs of the links you want to place in your page.

mavrosxristoforos
  • 3,343
  • 2
  • 24
  • 38
0

You have to use $var = mysql_real_escape_string($var);

You might also want to read up on SQL Injections, since your inputs are clearly unsanitized.

Suvash sarker
  • 3,082
  • 1
  • 17
  • 19