Making a SQL query in the database:

$ sql= 'INSERT INTO FAQ (Name, DESC, POS) Values ​​($ A, $ B, $ C)';

As can be seen from the query, there is a field in the table DESC. and it needs to put the text, but the SQL language determines this moment in the request not as a field, but as a command DESC. (for sorting descending). Accordingly, the request is not executed, and I have a white screen! For if you are torn this field for example in DESCR. (and in the database, respectively) then everything works .. But I needed that this field is called this way .. From here and the question is what I do is the word DESC. Defined as a field, and not as a team?

Contribute the name of the field in the inverse apostrophes, here are the `desc` (but then the register begins to be important, so make sure that it was created by small letters)

Mike2021-06-08 19:56:50

As far as I know, use the reserved words in the names -bad practice.

Jean-Claude2021-06-08 19:56:50

@ Jean-Claude, there is a rather big list to remember all dev.mysql.com/doc/refman/8.0/en/keywords.html

Кирилл Малышев2021-06-08 19:56:50

@ Cyrilmalyshev NFV 70% of such words, which is hardly when it comes to mind so to call the column. 29% and so use in everyday life, so you know them. And by 1%, with the error you say "Wow, and this is what a thing" and you go to read for general development.

teran2021-06-08 19:56:50