Jump to content

Slashes not being Added


abrahamgarcia27

Recommended Posts

the slashes \ should not be in the actual data in the database. they should only be in the sql query statement to indicate those characters that have special meaning that are part of the data and that are not to be interpreted as part of the query syntax.

 

how exactly are you looking at the data when you see the \ characters, because this is either a problem with php escaping your input data in addition to you escaping it or php escaping the data when you  retrieve it from the database.

 

note: this php behavior has been removed as of php5.4.

Is this bad?

yes. because php has now changed what it does to external data, any data that is (incorrectly) stored with the \'s in it cannot be searched for and found and by unconditionally running stripslashes() on any data, it will remove an real \'s in the data (which i see from looking at your previous threads - http://forums.phpfreaks.com/topic/255193-problem-searching/ you are doing.)

 

prior to php5.4, what you should have been doing is test if php's magic_quotes_gpc is ON and if it was use stripslashes to remove the escaping php was doing, then escaping the data yourself (note: this logic will still work in php5.4 and later as the function that tests if magic_quotes_gpc is on will return a false value.)

 

the best recommendation would be to remove any extra \ characters that are stored in your database tables.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.