Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Zapytanie nie działa tylko na localhost
lukasz91
post 21.01.2016, 11:56:55
Post #1





Grupa: Zarejestrowani
Postów: 149
Pomógł: 7
Dołączył: 6.01.2010
Skąd: Opole Lubelskie

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


Mam takie zapytanie:
  1. UPDATE product SET model = '3967', models = NULL, sku = '', ean = '', upc = '070 002 801/070 002 901'', location = '', date_enabled = '', date_disabled = '', manufacturer_id = '13', manufacturer_buygroup_id = NULL, points = '0', weight = '21', weight_class_id = '1', length = '50', width = '79', height = '50', length_class_id = '1', status = '1', test_mode = '0', search_status = '1', sort_order = '0', date_modified = NOW(), search_price = '0', meta_keyword = '', comparison_description = '', meta_description = 'Komora gospodarcza biała PYRAMIS Multiset 2 kolory'', slug = 'komora-gospodarcza-biala-pyramis-multiset-2-kolory', canonical = '0', manufacturer_insurance_id = '213', allegro_miniatures_for_stores = '' WHERE product_id = '14980'


Na localhost parser wywala mi błąd:
  1. SQLSTATE[42000]: Syntax error OR access violation: 1064 You have an error IN your SQL syntax; CHECK the manual that corresponds TO your MariaDB server version FOR the RIGHT syntax TO USE near '13', manufacturer' at line 4


Problem występuje tylko na moim localhost. Ten sam kod działa bez zarzutu na serwerze. Mam zainstalowany xampp-win32-5.6.15-1-VC11


--------------------
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 3)
Riggs
post 21.01.2016, 12:01:03
Post #2





Grupa: Zarejestrowani
Postów: 162
Pomógł: 13
Dołączył: 16.06.2007

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


Masz jeden znak ' za dużo w upc = ....
powinno być
  1. UPDATE product SET model = '3967', models = NULL, sku = '', ean = '', upc = '070 002 801/070 002 901', location = '', date_enabled = '', date_disabled = '', manufacturer_id = '13', manufacturer_buygroup_id = NULL, points = '0', weight = '21', weight_class_id = '1', length = '50', width = '79', height = '50', length_class_id = '1', status = '1', test_mode = '0', search_status = '1', sort_order = '0', date_modified = NOW(), search_price = '0', meta_keyword = '', comparison_description = '', meta_description = 'Komora gospodarcza biała PYRAMIS Multiset 2 kolory'', slug = 'komora-gospodarcza-biala-pyramis-multiset-2-kolory', canonical = '0', manufacturer_insurance_id = '213', allegro_miniatures_for_stores = '' WHERE product_id = '14980'
Go to the top of the page
+Quote Post
lukasz91
post 21.01.2016, 13:34:56
Post #3





Grupa: Zarejestrowani
Postów: 149
Pomógł: 7
Dołączył: 6.01.2010
Skąd: Opole Lubelskie

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


Też to zauważyłem po dodaniu postu (kolorowanie pomogło) smile.gif. Okazało się, że przez strlen nie ucinało apostrofu. Użycie mb_strlen rozwiązało problem. Dziwne tylko, że na serwerze nie sypało błędami...


--------------------
Go to the top of the page
+Quote Post
Pyton_000
post 21.01.2016, 14:39:00
Post #4





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

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


Jakbyś zobaczył logi to byś ujrzał prawdę wink.gif
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: 14.08.2025 - 06:57