Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [MySQL] Zapytanie do bazy wyszukujące &lt;\b&gt; (<\b>)
fenix.robi
post 22.07.2010, 11:55:19
Post #1





Grupa: Zarejestrowani
Postów: 97
Pomógł: 7
Dołączył: 24.06.2008

Ostrzeżenie: (0%)
-----


Mam do poprawienia błędne znaczniki wprowadzone do pola tekstowego w bazie istnieje wpis <\b> istnieje pod wyrażeniem
Kod
& lt;\b& gt; //bez spacji oczywiscie

lecz zapytanie
  1. SELECT `id`,`opis` FROM `artykuly` WHERE `opis` LIKE "%& lt;\b& gt;%" LIMIT 0 , 10

lub
  1. SELECT `id`,`opis` FROM `artykuly` WHERE `opis` LIKE "%& lt;\\b& gt;%" LIMIT 0 , 10

Nie pobiera zadnych rekordów

Ten post edytował fenix.robi 22.07.2010, 12:21:48
Go to the top of the page
+Quote Post
blahy
post 22.07.2010, 12:24:47
Post #2





Grupa: Zarejestrowani
Postów: 82
Pomógł: 22
Dołączył: 20.07.2010

Ostrzeżenie: (0%)
-----


z reference manuala:
Because MySQL uses C escape syntax in strings (for example, “\n” to represent a newline character), you must double any “\” that you use in LIKE strings. For example, to search for “\n”, specify it as “\\n”. To search for “\”, specify it as “\\\\”; this is because the backslashes are stripped once by the parser and again when the pattern match is made, leaving a single backslash to be matched against.
Go to the top of the page
+Quote Post
fenix.robi
post 22.07.2010, 12:53:16
Post #3





Grupa: Zarejestrowani
Postów: 97
Pomógł: 7
Dołączył: 24.06.2008

Ostrzeżenie: (0%)
-----


Cytat(blahy @ 22.07.2010, 13:24:47 ) *
z reference manuala:
Because MySQL uses C escape syntax in strings (for example, “\n” to represent a newline character), you must double any “\” that you use in LIKE strings. For example, to search for “\n”, specify it as “\\n”. To search for “\”, specify it as “\\\\”; this is because the backslashes are stripped once by the parser and again when the pattern match is made, leaving a single backslash to be matched against.


Fajnie, zobacz drugie zapytanie SQL
Go to the top of the page
+Quote Post
attimo
post 22.07.2010, 13:00:53
Post #4





Grupa: Zarejestrowani
Postów: 115
Pomógł: 6
Dołączył: 23.01.2010

Ostrzeżenie: (0%)
-----


Kiedyś miałem podobny problem sprob tak:
  1. SELECT `id`,`opis` FROM `artykuly` WHERE `opis` LIKE "{%& lt;\\b& gt;%}" LIMIT 0 , 10
Go to the top of the page
+Quote Post
fenix.robi
post 22.07.2010, 13:07:24
Post #5





Grupa: Zarejestrowani
Postów: 97
Pomógł: 7
Dołączył: 24.06.2008

Ostrzeżenie: (0%)
-----


Cytat(attimo @ 22.07.2010, 14:00:53 ) *
Kiedyś miałem podobny problem sprob tak:
  1. SELECT `id`,`opis` FROM `artykuly` WHERE `opis` LIKE "{%& lt;\\b& gt;%}" LIMIT 0 , 10

Hmm spieszyło mi się i zrobiłem pętle, pobierałem co 100 bez warunków WHERE i parsowałem phpem i zapisałem, wiec już poprawione, ale dzięki, zapamiętam twoją radę, może kiedyś będzie przydatna biggrin.gif ale dzięki jeszcze raz
Go to the top of the page
+Quote Post
blahy
post 22.07.2010, 13:09:19
Post #6





Grupa: Zarejestrowani
Postów: 82
Pomógł: 22
Dołączył: 20.07.2010

Ostrzeżenie: (0%)
-----


to ja juz nie rozumiem o co ci chodzi
  1. SELECT * FROM `test` WHERE `txt` LIKE "%<\\\\b>%"

zwraca
rekord z takim tekstem: asasdasda<\b>sd
Twoje drugie zapytanie nie zwraca rekordow bo jest zle w mysl tego cytatu co wyslalem
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 19.06.2025 - 09:05