Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 帕格不是';将JSON从查询呈现到表中_Html_Mysql_Node.js_Json_Pug - Fatal编程技术网

Html 帕格不是';将JSON从查询呈现到表中

Html 帕格不是';将JSON从查询呈现到表中,html,mysql,node.js,json,pug,Html,Mysql,Node.js,Json,Pug,index.js router.post('/queryrabbits', function(req, res, next) { console.log("Someone is querying your database as follows."); console.log(req.body.SQLQuery); var sql = req.body.SQLQuery; var connection = mysql.createConnection({

index.js

router.post('/queryrabbits', function(req, res, next) {
  console.log("Someone is querying your database as follows.");
  console.log(req.body.SQLQuery);
  var sql = req.body.SQLQuery;
  var connection = mysql.createConnection({
    host: 'localhost',
    port: '3306',
    user: 'newuser',
    password: 'redacted',
    database: 'redacted',
    insecureAuth: true
  })
  connection.connect();
  connection.query('select * from rabbitdb.rabbit', function(err, results) {
    var string =JSON.stringify(results);
    console.log(JSON.parse(string));
    connection.end();
    res.render('results', {kickBack : string});
  });

});
我已经尝试了在堆栈溢出上找到的所有方法,但在将查询结果呈现到表中时遇到了问题。一些更糟糕的尝试使我的浏览器崩溃,因为它呈现了一个包含750多个不同行的表

有什么建议吗

extends layout

block content
    table
        for item in kickBack
            td #{item.val1}
            td #{item.val2}
            etc