I need to check the title of the article for uniqueness. I decided to do this:

SELECT COUNT(*) as count FROM table WHERE `title` = 'Π—Π°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ ΡΡ‚Π°Ρ‚ΡŒΠΈ' 

Everything works, but if there are escaped characters in the string, for example:

 SELECT COUNT(*) as count FROM table WHERE `title` = 'Π—Π°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ \"ΡΡ‚Π°Ρ‚ΡŒΠΈ\" с ΠΊΠ°Π²Ρ‹Ρ‡ΠΊΠ°ΠΌΠΈ' 

then the count result is 0. I understand that I don’t understand something. How to find a unique title?

  • Let's say that select 1 from DUAL where 'Π—Π°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ \"ΡΡ‚Π°Ρ‚ΡŒΠΈ\" с ΠΊΠ°Π²Ρ‹Ρ‡ΠΊΠ°ΠΌΠΈ' = 'Π—Π°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ "ΡΡ‚Π°Ρ‚ΡŒΠΈ" с ΠΊΠ°Π²Ρ‹Ρ‡ΠΊΠ°ΠΌΠΈ' returns excellent 1. It means that either you have a line in your database like something else or something that you execute the query interpolates backslips like that - Mike
  • The fact of the matter is that I, using phpmyadmin, copy a string from a cell with a header, insert it into the query in the same phpmyadmin and get 0. I tried to add / remove screening and change single quotes to double quotes. I get 0. - Coolmac
  • Data type varchar, comparison uft8_general_ci, table type MyISAM. - Coolmac
  • then do not use phpmyadmin, it devils what it can do. try directly in the mysql utility in the console. or some normal means of working with mysql, take, like MySQL workbench (although I have the same weight of questions about convenience) ... - Mike
  • By the way .... maybe he just shows up with obast obliques - it is in the database with reverse obliques. then the skews in the request must be doubled ... 'Π—Π°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ \\"ΡΡ‚Π°Ρ‚ΡŒΠΈ\\" с ΠΊΠ°Π²Ρ‹Ρ‡ΠΊΠ°ΠΌΠΈ' - Mike

1 answer 1

Reply from comments from Mike

Use query type

 SELECT COUNT(*) AS count FROM table WHERE `title` = 'Π—Π°Π³ΠΎΠ»ΠΎΠ²ΠΎΠΊ \\"ΡΡ‚Π°Ρ‚ΡŒΠΈ\\" с ΠΊΠ°Π²Ρ‹Ρ‡ΠΊΠ°ΠΌΠΈ'