Query a connection object without parameters

suggest change

Pass the SQL string to connection.query. The callback is error-first: err, then rows, then fields. Each row contains the columns from that result. This is the mysql / mysql2 callback shape.

connection.query('SELECT name, email FROM users', function (err, rows, fields) {
  if (err) throw err;

  console.log('There are:', rows.length, 'users');
  if (rows.length) {
    console.log('First user name is:', rows[0].name);
  }
});

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents