mysql_real_escape_string HELP!!

Started on the old forum in May 2012 · view the original in the archive · old links redirect here

23 replies · 1,441 views · started 14 years ago · 1 min read

10 participants
icedroplet1987 Senior · 258 posts #21

GumSlone wrote: if you do it the same way like in my examples everything will be ok.

ok but i did as methulj mentioned.. covered all requests.. so its safe . right?

have a look on methulj code sir.

analyzer Developer · 104 posts #22

metulj - mysql_real_escape_string() cannot stand alone. . . Like what you did. . htmlspecialchars and striptags was added which is better.

It's n0t that i am afraid to die. Its just that if i die, wh0 wilL loVe her as muCh as i Do?

GumSlone Administrator Principal · 1,690 posts #23

analyzer wrote: metulj - mysql_real_escape_string() cannot stand alone. . . Like what you did. . htmlspecialchars and striptags was added which is better.

of cause it can stand alone, striptags and html special chars is another story, and we talk here about prevention of mysql injection, so mysql_real_escape_string will do the job.

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

CreativityKills Lead · 833 posts #24

Well i dont think there is more to add, Gumslone already said it all. Most developers on here confuse mysql_real_escape_string and htmlspecialchars. Ive seen a lot of times where some apps here pass data to the database using the htmlspecialchars function. Thats wrong. mysql_real_escape_string and proper coding practice can handle injection just fine. htmlspecialchars should be used ONLY to escape special characters that might be stored in the DB harmlessly but could come out to be potential XSS attacks. For instance someone posted in a forum:

<b>This is an injected html code.

When fetching from the database, it would save u alot of heartache if you just escape with htmlspecialchars that way the browser doesnt interprete the < b > as html tags but as string. Thats where that function comes into play, not for sql query escaping.

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close