Jump to content


Photo

scaping single quote


  • Please log in to reply
3 replies to this topic

#1 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 27 May 2006 - 12:51 AM

how do i scape a single quote from a text fiel?

#2 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 27 May 2006 - 12:54 AM

It depends on what you want to do with the string. There's the function [a href=\"http://www.php.net/addslashes\" target=\"_blank\"]addslashes()[/a] that's good for most purposes. If you're going to be insterting the data into a mysql database, you should use the [a href=\"http://www.php.net/mysql_real_escape_string\" target=\"_blank\"]mysql_real_escape_string()[/a] function.

Ken

#3 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 27 May 2006 - 01:00 AM

yeah becuase i ot a for for users to fill it up and some times they add some thing like i'm this.. and the quote kills the query so i should add the real scape strign on every variable that is going into mysql?

#4 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 27 May 2006 - 01:24 AM

ye sit worked life saver :)

one mroe thing ken..

i got a lost password scrip but whe the person enters the email that they got in the database.. mysql has problems reading the @ sign.. show as a syntax error.. error in '@whatever.com in my scrip i just passthe email as a variable..




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users