slashes problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

slashes problem

Post by itsmani1 »

Hello
Please check: http://beta.cmela.com/pro_view.php?pid=59

In product description you will see slashes i used stripshashes but still no luck.

I have another idea of using htmlspecialchars function like:

Code: Select all

$new = htmlspecialchars('15.5" color TV/Free Shipping', ENT_QUOTES);
Basically my requirement is to able to allow user to put following character like single quote, double quote, slahses (' " / \) in db but no hacking or sql injection should occur.

any help

thank you
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: slashes problem

Post by Christopher »

You need to use the database specific escaping function. You can also convert characters to HTML entities. Also check your database setting for character set. The database may retain or remove the escaped characters depending on the settings.
(#10850)
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Re: slashes problem

Post by itsmani1 »

tables type: InnoDB
MySQL charset: UTF-8 Unicode (utf8)

i have a check of string count, if the submitted string is less than 50 characters then it will give me error message, now the problem is if i submitted '15.5" new / used tv' this will give error but if i try to display it in html field this will not show complete string.

thank you
Post Reply