Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [MySQL] Zapytanie do bazy wyszukujące &lt;\b&gt; (<\b>)
Forum PHP.pl > Forum > Przedszkole
fenix.robi
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
blahy
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.
fenix.robi
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
attimo
Kiedyś miałem podobny problem sprob tak:
  1. SELECT `id`,`opis` FROM `artykuly` WHERE `opis` LIKE "{%& lt;\\b& gt;%}" LIMIT 0 , 10
fenix.robi
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
blahy
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
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.