...

View Full Version : php cant save single quote data into the my sqltable



coolumanga
10-26-2012, 12:33 PM
hi

i have a item code as SH-GHY'

i need to save this item in to the table but it save as SH-GHY
how do i save as it is in the item code

durangod
10-26-2012, 01:45 PM
Have you tried to sanitize that with mysql_real_escape_string before storing it to the table.

If that does not give you the desired affect, try storing it as SH-GHY\' and in either case when you display it on the page use stripslashes to display it.

MarkR
10-26-2012, 05:01 PM
You need to sanatise your data, look at using real-escape-string() (http://php.net/manual/en/mysqli.real-escape-string.php) or even better use prepared statements (http://mattbango.com/notebook/web-development/prepared-statements-in-php-and-mysqli/).

Google SQL Injection for the reasons to use these methods.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum