corillo181 Posted May 27, 2006 Share Posted May 27, 2006 how do i scape a single quote from a text fiel? Quote Link to comment https://forums.phpfreaks.com/topic/10548-scaping-single-quote/ Share on other sites More sharing options...
kenrbnsn Posted May 27, 2006 Share Posted May 27, 2006 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 Quote Link to comment https://forums.phpfreaks.com/topic/10548-scaping-single-quote/#findComment-39344 Share on other sites More sharing options...
corillo181 Posted May 27, 2006 Author Share Posted May 27, 2006 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? Quote Link to comment https://forums.phpfreaks.com/topic/10548-scaping-single-quote/#findComment-39346 Share on other sites More sharing options...
corillo181 Posted May 27, 2006 Author Share Posted May 27, 2006 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.. Quote Link to comment https://forums.phpfreaks.com/topic/10548-scaping-single-quote/#findComment-39348 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.