Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [MySQL] operator porównania !=
lukko
post
Post #1





Grupa: Zarejestrowani
Postów: 49
Pomógł: 0
Dołączył: 12.03.2009

Ostrzeżenie: (10%)
X----


Witam,

W Zapytaniu chce uzyskać efekt by w sklepie internetowym nie pojawiały się produkty bez zdjęć, czyli te które w komórce tabeli mają wartość: _no_.gif

Więc robiłem z:
Kod
p.products_image != '_no_.gif'
p.products_image <> '_no_.gif'


I nadal wyświetla mi produkty z _no_.gif

A oto całe zapytanie:

Kod
$products_new_query_raw = "select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, p.manufacturers_id, m.manufacturers_name, p.products_quantity from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where (TO_DAYS(now()) - TO_DAYS(p.products_date_added) < 14) AND p.products_status2 = '1' and p.products_status = '1' and p.products_weight > '0.000' and p.products_image != '_no_.gif' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' ";


Co ja mogę robić nie tak? Z wartościami liczbowymi jest dużo prościej... a tego coś ogarnąć nie mogę
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 6)
piotrooo89
post
Post #2


Newsman


Grupa: Moderatorzy
Postów: 4 005
Pomógł: 548
Dołączył: 7.04.2008
Skąd: Trzebinia/Kraków




  1. p.products_image NOT LIKE '_no_.gif'


--------------------
Go to the top of the page
+Quote Post
darko
post
Post #3





Grupa: Zarejestrowani
Postów: 2 885
Pomógł: 463
Dołączył: 3.10.2009
Skąd: Wrocław

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


and p.products_image NOT LIKE '_no_.gif'
?


--------------------
Nie pomagam na pw, tylko forum.
Go to the top of the page
+Quote Post
piotrooo89
post
Post #4


Newsman


Grupa: Moderatorzy
Postów: 4 005
Pomógł: 548
Dołączył: 7.04.2008
Skąd: Trzebinia/Kraków




aha i polecam: http://dev.mysql.com/doc/refman/5.0/en/com...-operators.html


--------------------
Go to the top of the page
+Quote Post
lukko
post
Post #5





Grupa: Zarejestrowani
Postów: 49
Pomógł: 0
Dołączył: 12.03.2009

Ostrzeżenie: (10%)
X----


A NOT LIKE fakt nie pomyślałem o tym ale kurde nadal mi się wyświetlają zdjęcia z: _no_.gif

Kod
$products_new_query_raw = "select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, p.manufacturers_id, m.manufacturers_name, p.products_quantity from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where (TO_DAYS(now()) - TO_DAYS(p.products_date_added) < 14) AND p.products_status2 = '1' and p.products_status = '1' and p.products_weight > '0.000' and p.products_image NOT LIKE '_no_.gif' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' ";


products_image i products_weight są w tej samej tabeli TABLE_PRODUCTS no i z wagą większą niż zero działa ok a to nie hm... Błędu też mi nie wywala żadnego, o co może być kaman ?

Ten post edytował lukko 21.12.2009, 10:38:14
Go to the top of the page
+Quote Post
Maciek1705
post
Post #6





Grupa: Zarejestrowani
Postów: 157
Pomógł: 3
Dołączył: 15.06.2009

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


spróbuj zmienić to na
  1. AND p.products_image <> 'no_gif'
Go to the top of the page
+Quote Post
lukko
post
Post #7





Grupa: Zarejestrowani
Postów: 49
Pomógł: 0
Dołączył: 12.03.2009

Ostrzeżenie: (10%)
X----


Poszło z NOT LIKE coś zakręcone w bazie miałem smile.gif dzięki!
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 Aktualny czas: 21.08.2025 - 13:01