SQL problem occuring with PHP but notin the DBMS itself

SQL problem occuring with PHP but notin the DBMS itself

Hi I run a query without any problem in the MariaDB phpMyAdmin, SQL tab, and I receive fully the anticipated result. When trying to run the same query from a PHP program, I get an error message from the DBMS, saying: -> " Database error -->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 'Livsmedelsnamn", Livsmedelsnummer "Livsmedelsnummer", Grupperi...' at line 1 -Lista/3-->SELECT Livsmedelsnamn "Livsmedelsnamn", Livsmedelsnummer "Livsmedelsnummer", Gruppering "Kategori / Gruppering", Energikcal "Energi (kcal)", EnergikJ "Energi (kJ)", Kolhydraterg "Kolhydrater (g)", Fettg "Fett (g)", Proteing "Protein (g)", Fibrerg "Fibrer (g)", Vatteng "Vatten (g)", Alkoholg "Alkohol (g)", Askag "Aska (g)", Monosackariderg "Monosackarider (g)", Disackariderg "Disackarider (g)", Sackarosg "Sackaros (g)", Fullkorn_totaltg "Fullkorn totalt (g)", Sockerarterg "Sockerarter (g)", Summa_mättade_fettsyrorg "Summa mättade fettsyror (g)", Fettsyra_4ratio0hyph10ratio0g "Fettsyra 4:0-10:0 (g)", Laurinsyra_C12ratio0g "Laurinsyra C12:0 (g)", Myristinsyra_C14ratio0g "Myristinsyra C14:0 (g)", Palmitinsyra_C16ratio0g "Palmitinsyra C16:0 (g)", Stearinsyra_C18ratio0g "Stearinsyra C18:0 (g)", Arakidinsyra_C20ratio0g "Arakidinsyra C20:0 (g)", Summa_enkelomättade_fettsyrorg "Summa enkelomättade fettsyror (g)", Palmitoljesyra_C16ratio1g "Palmitoljesyra C16:1 (g)", Oljesyra_C18ratio1g "Oljesyra C18:1 (g)", Summa_fleromättade_fettsyrorg "Summa fleromättade fettsyror (g)", Linolsyra_C18ratio2g "Linolsyra C18:2 (g)", Linolensyra_C18ratio3g "Linolensyra C18:3 (g)", Arakidonsyra_C20ratio4g "Arakidonsyra C20:4 (g)", EPA_C20ratio5g "EPA C20:5 (g)", DPA_C22ratio5g "DPA C22:5 (g)", DHA_C22ratio6g "DHA C22:6 (g)", Kolesterolmg "Kolesterol (mg)", Retinolug "Retinol (µg)", Vitamin_A_REslashug "Vitamin A (RE/µg)", Beta_Karotenug "Beta Karoten (µg)", Vitamin_Dug "Vitamin D (µg)", Vitamin_Emg "Vitamin E (mg)", Vitamin_Kug "Vitamin K (µg)", Vitamin_B1_Tiamin_mg "Vitamin B1 (Tiamin) (mg)", Vitamin_B2_Riboflavin_mg "Vitamin B2 (Riboflavin) (mg)", Vitamin_Cmg "Vitamin C (mg)", Vitamin_B3_Niacin_Nikotinsyra_mg "Vitamin B3 (Niacin Nikotinsyra) (mg)", Niacinekvivalenter_NEslashmg "Niacinekvivalenter (NE/mg)", Vitamin_B6_Pyridoxin_mg "Vitamin B6 (Pyridoxin) (mg)", Vitamin_B12_Kobalamin_ug "Vitamin B12 (Kobalamin) (µg)", Vitamin_B9_Folsyra_Folinsyra_Folat_ug "Vitamin B9 (Folsyra Folinsyra Folat) (µg)", Fosformg "Fosfor (mg)", Jodug "Jod (µg)", Järnmg "Järn (mg)", Kalciummg "Kalcium (mg)", Kaliummg "Kalium (mg)", Magnesiummg "Magnesium (mg)", Natriummg "Natrium (mg)", Saltg "Salt (g)", Selenug "Selen (µg)", Zinkmg "Zink (mg)", Avfall_skal_etc_proc "Avfall (skal etc) (%)" FROM `tNut_SLV_db` order by Livsmedelsnamn asc; "

In the PHP program, I run various queries without any problems whatsoever. This erroneous query is 2526 characters long -- Is that breaching some SQL query character length limit settings of the DBMS? Or else, what could be the reason for the error? Like I said, no problem running the query directly in phpMyAdmin.

Answer Answered by Ian Gilfillan in this comment.

A guess would be a quoting error. The code you've pasted appears to use double quotes both in the query and to enclose the query.

Comments

Comments loading...
Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.