View Single Post

  #12 (permalink)  
Old 21-03-2008, 12:50 AM
Frodo's Avatar
Frodo Frodo is offline
Ciaran Rooney - Weeno Ltd
Recent Blog:
[CaRP] XML error: Invalid document end at line 2
 
Join Date: Jan 2007
Location: London
Posts: 362
Nominated 0 Times in 0 Posts
TOTW/F/M Award(s): 0
Frodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud ofFrodo has much to be proud of
Send a message via MSN to Frodo Send a message via Skype™ to Frodo
Default

Quote:
Originally Posted by Frodo View Post
It escapes nasty charters in you sql statements. It's essential to stop mysql injection attacks.

Your insert code should look like this:

PHP Code:
$content $_POST['content'];
$dbcontent mysql_escape_string($content);
$sql="insert into some_table(msContent) values ('".$dbcontent."')";
$result mysql_query($sql,$conn) or die("Fail"); 
It should go before your insert/update. It will turn this

Code:
insert into some_table(msContent) values ('This is some content with " in it and  ' in it and things like that')
into

Code:
insert into some_table(msContent) values ('This is some content with \" in it and  \' in it and things like that')
It sounds like you have other functions that are causing this problem, like the html_entities function that goergie mentions.
__________________
PHP Code:
print "CEO Weeno Ltd   - http://www.weeno.ie";
print 
"CTO Skimbit Ltd - http://skimbit.com"
skimlinks.com :: Outsource your affiliate marketing and generate revenue from your content easily.
Reply With Quote