Mysql
 sql >> Datenbank >  >> RDS >> Mysql

nodejs mysql multiple where Abfragen

results sind Antwortzeilen von mysql.

Vereinfachen wir Teile:

const 
  q = "SELECT * FROM user_information WHERE username=? OR email=?", // You can use placeholders like ? marks 
  args = [registerarray[1], registerarray[3]]; // array of values that will be set to placeholders (will be escaped for security)
connection
  .query(
    q, // our query
    args,  // placeholder values
    (err, records) => { // query response scope begins here
      if (err) {
        console.error(err);
      }

      console.log('THIS IS RESULT OF QUERY EXECUTION:');
      console.log(records); // this is result, already fetched array
    });