Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Zapytanie nie działa tylko na localhost
Forum PHP.pl > Forum > PHP
lukasz91
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
Riggs
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'
lukasz91
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...
Pyton_000
Jakbyś zobaczył logi to byś ujrzał prawdę wink.gif
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.