954,585 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

mysql_real_escape_string ?

Hi,

Me again...

Just wanted to know, i have this piece of code to enter the data from a registration form of mine into the user db.

I want to use the mysql_real_escape_string to help stop those evil people who enjoys hacking from hacking my DB

$query = "INSERT INTO userinformation (username, first_name, last_name, email, password, date_time) VALUES ('$username', '$first_name', '$last_name', '$email', '$password', '$date_time')";

could someone tell me where i need to put the mysql_real_escape_string function to stop it happening, i am not sure where i place it by or how i code it,

thank you,
genieuk

genieuk
Junior Poster
150 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 
$username=mysql_real_escape_string($username);

write before the query

Hi,

Me again...

Just wanted to know, i have this piece of code to enter the data from a registration form of mine into the user db.

I want to use the mysql_real_escape_string to help stop those evil people who enjoys hacking from hacking my DB

$query = "INSERT INTO userinformation (username, first_name, last_name, email, password, date_time) VALUES ('$username', '$first_name', '$last_name', '$email', '$password', '$date_time')";

could someone tell me where i need to put the mysql_real_escape_string function to stop it happening, i am not sure where i place it by or how i code it,

thank you, genieuk

sarithak
Junior Poster
183 posts since Aug 2008
Reputation Points: 10
Solved Threads: 7
 

check out link..
http://in2.php.net/mysql_real_escape_string

hope will help you..

Aamit
Posting Whiz
342 posts since Apr 2008
Reputation Points: 3
Solved Threads: 15
 

This might also help.

Preventing SQL Injection

TopDogger
Junior Poster in Training
87 posts since Aug 2005
Reputation Points: 15
Solved Threads: 5
 

This might also help.

Preventing SQL Injection


Thank you, althou i sorted it that is a very good read. Much appreciated.

Thanks very much.
genieuk

genieuk
Junior Poster
150 posts since Apr 2009
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You