It is necessary to select a row from the database, if you use sampling by a numeric column, then everything works fine, but if the column with a row returns an empty result and no errors. SQL in phpmyadmin on the server works great. Code (made specifically to check if it works):

con.query("SELECT unit FROM `units_info` WHERE `name`=?",[match[1]],function (error,row){ console.log('errors:'+error); console.log(row)}); 

Match [1] is a string variable, the result of processing the string entered by the user by a regular expression.

Even if instead of name =? enter name = 'Text' does not work (although it is handled well in phpmyadmin)

  • Well, if there are no errors, then look at the table for the row with the value of match [1] and what is the match [1] at the time of the query. - Doigrales
  • Just in case - and if "SELECT unit FROM `units_info` WHERE `name`='?' " "SELECT unit FROM `units_info` WHERE `name`='?' " ... - Akina
  • He took the place where the variable (question mark) should be inserted into single quotes did not help - Vladsg

1 answer 1

It turned out to be easier than I thought, the error was in the encoding!