Jump to content

Best way to escape?


rarebit

Recommended Posts

That's not a real word... I think o_o

 

When you connect to a mysql db, that connection will be required in order to use mysql_real_escape_string. It's supercalafrijalisticexpialadociously amazing (+10 for kratsg). You cannot use it alone without having that pre-existing connection on the page. It's not slow in any sense (not unless you use it on an array of 500 million pieces of data, in which case even addslashes would be slow :-P same for htmlentities, striptags, etc..)

Link to comment
https://forums.phpfreaks.com/topic/121947-best-way-to-escape/#findComment-629433
Share on other sites

The manual states in mysql_real_escape_string() documentation:

 

This function must always (with few exceptions) be used to make data safe before sending a query to MySQL.

 

But it doesnt say this in the addslashes() documentation. So basically you get the answer 8). +50 for GuiltyGear

Link to comment
https://forums.phpfreaks.com/topic/121947-best-way-to-escape/#findComment-629440
Share on other sites

The manual states in mysql_real_escape_string() documentation:

 

This function must always (with few exceptions) be used to make data safe before sending a query to MySQL.

 

But it doesnt say this in the addslashes() documentation. So basically you get the answer 8). +50 for GuiltyGear

 

You only get points for using your own words... So hah! You quoted from php.net.. You get respect, but not points.. :-o

Link to comment
https://forums.phpfreaks.com/topic/121947-best-way-to-escape/#findComment-629448
Share on other sites

Guilty Gear

An example use of addslashes() is when you're entering data into a database.

 

But, mysql_real_escape_string uses a socket (tcp packetised) and the a binary function, whereas using addslashes just uses a binary function, thats my reasoning anyway. Also mysql_real_escape_string probably uses other functions as well...

 

 

Bodacious dudes!

 

 

P.S. 'insurmountably' is a word, also +1 for correct spelling!

Link to comment
https://forums.phpfreaks.com/topic/121947-best-way-to-escape/#findComment-629459
Share on other sites

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.