The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. September 18, 2019, 11:13:37 AM

Login with username, password and session length


Pages: [1]
  Print  
Author Topic: Magic quotes, addslashes, htmlentities, str_replace, wtf  (Read 2700 times)
jammaster82
Lifer
*****
Offline Offline

Posts: 666


Thats craigs list for ya


View Profile
« on: April 06, 2010, 08:19:35 PM »

Ok, im trying to organize this in my mind.   Where do i start?

the trick is that i have some data in a mysql table.

Does the encoding type matter?

The data is :

Adams County Sheriff’s Office

Thats chr(146) not chr(39) in sheriffs its like a left pointing apostrophe

So do i put a slash before that? because its
torching the insert... Do i call addslashes?
Html_entities? mysql_escape_string?

What do i have to do to be able to store/retrieve all data
in sql from php...is there a list of characters somewhere
I have to str_replace to get through? Do i Use
Magic Quotes which is now deprecated? 

Logged

The watched pot, never boils... But if you walk away from it , the soup burns.  What gives?
nutballs
Administrator
Lifer
*****
Offline Offline

Posts: 5627


Back in my day we had 9 planets


View Profile
« Reply #1 on: April 06, 2010, 11:37:34 PM »

Yes its a quote and needs a slash in front. there are actually a boatload of those special FU characters.

Sooooooo. you have a few choices.

you can mess around with quoting and escaping.
OR
you can say screw it and encode the whole thing.

Either hexcode everything if you need to search for parts of fields.
or you can base64 encode.

If you have a need for the data to be human readable in the database, this doesnt work of course.
Logged

I could eat a bowl of Alphabet Soup and shit a better argument than that.
Pages: [1]
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!