View Full Version : php cant save single quote data into the my sqltable
10-26-2012, 01:33 PM
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
10-26-2012, 02: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.
10-26-2012, 06: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.
Powered by vBulletin® Version 4.2.2 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.