Jul 20, 2008

Question Regarding Magic_quotes And Addslashes()

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

Question Regarding Magic_quotes And Addslashes()

awesomebill61
my php configuration has magic_quotes_runtime set to off
so, when i pull a string out of a mysql db, how come it shows up just fine without running it through addslashes()?
when i run it through addslashes(), it adds slashes where its supposed to.... but when i don't use it it shows up just fine
i am curious as to why i dont have to run addslashes() to make my text show up right
can anyone answer my question?

Reply

jlhaslip
Magic_quotes function adds slashes to strings going to a Database. If it is set 'off', then the Database does not contain the escapes "\", so they won't be there when you return the data.
Magic_quotes is deprecated in php6.

http://ca.php.net/manual/en/ref.info.php#i...-quotes-runtime

Reply

truefusion
Whenever you pull something out of your database that has slashes added to it, always strip the slashes using the stripslashes() function. It is better for you to add slashes to any input that's going into the database for security reasons. But it's better to use the mysql_real_escape_string() function than addslashes().

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : magic quotes addslashes


    Looking for magic, quotes, addslashes,

Searching Video's for magic, quotes, addslashes,
advertisement



Question Regarding Magic_quotes And Addslashes()



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE