请求查询记录以在node.js中查询结果

时间:2019-04-10 07:38:09

标签: jquery mysql node.js

我想当某些用户加入时,检查该用户是否已经是成员。 然后,如果不是,请加入我们继续。

connection.query(query, function (error, results, fields) {
      // When done with the connection, release it.
      connection.release();

      // Handle error after the release.
      if (error) callback(error);
      else callback(null, results[0]);

        if (results[0]) {

          connection.query(query, function (error, results, fields) {
            // When done with the connection, release it.
            connection.release();

            // Handle error after the release.
            if (error) callback(error);
            else callback(null, "Success insert")

            // Don't use the connection here, it has been returned to the pool.
          });

        }

      // Don't use the connection here, it has been returned to the pool.
    });

这是我的问题。 根据条件嵌套查询语句是否正确? 就像在connection.query {}

的内部和内部一样

0 个答案:

没有答案