Sir I have a search engine on my website which get input by user and search it for the results and i am storing those keywords into seperate table name keywords, but now a days i m checking that there is a bunch of unknown characters into query strings, i have used htmlspecialchars() funcntion and mysql_real_escape_string() functions to check if it will help me but i m not success i have attached the db image to you guyz to check and help me out, and also give me a mysql query to so with at once i can remove those chars from my db and can clean my db and in future i want to prevent those keywrods from inserting into my db thans! and tell me which of the keyboard keys which making this type of keywords thanks!

d9549f2f18eabd79381254f88a998333

shouldn't you first take query string apart into keywords and THEN save them? what exactly is the code you tried and your result? Please be more specific so people can help you....

That looks like incorrect saving of unicode characters, so my guess is that someone is using arabic, cyrillic or any other non latin encoding in your search.

That looks like incorrect saving of unicode characters, so my guess is that someone is using arabic, cyrillic or any other non latin encoding in your search.

yes you are right one of my friend outside of this community told me that you should use utf8 uni code into your meta tags so then this type of nonsense characters will be prevent from inserting it into db, if you guyz has more information please share with me or i will be consider that MR PRITAEAS as solved post thanks!

Okey I have done as you told me so now what about already done with my db entries how to remove these annoying characters from my db what should b the query for removing those keywords thanks!

Also help me if user has input with non english words so i can removce those none english words from the string

You might be able to run some query like:

DELETE FROM table_name WHERE some_column LIKE '%<some special character>%'

The percent signs are wild cards, so you would just take what ever character you are looking for (copy and paste?) and stick in between the %%. I have never tried this though, so I am not entirely sure that would work with what you are trying to do.

To keep people from entering in the foreign double byte characters, you could do some form validation in PHP with preg_match or something else, and check for non standard latin characters on the input.

An example (that might just work):

preg_match("/^[\w\d\s.,-]*$/", $string)

Thanks pixelsoul for helping me out i have already solved the problem with some of bit searching on google and thanks for your reply with same solutions now i m marking this thread to solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.