node.js mysql数据查询 返回值问题
发布于 3个月前 作者 xiaoxi-- 237 次浏览 来自 问答

var crypto = require(‘crypto’); var http = require(‘http’); var fs = require(‘fs’); var mysql = require(‘…/models/db.js’);

exports.backfind = function(req, res) { var input=req.body.input; var startdate=req.body.startdate; var enddate=req.body.enddate; var input1=parseInt(req.body.input1);

if (input==1) { mysql.query('select city from xiao ORDER BY City DESC limit 0,10’,function(err,rows,fields){ if (err) { return res.send(‘1’); } if (rows) { //console.log(rows) return res.send ('2’+rows) } }) }else{ return res.send(‘3’); } };

exports.backfindp = function(req, res) { res.render('901’,{title:’897157’}); };

web页面返回值为:2[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

2 回复

('2'+rows) 这句改成 ('2'+JSON.stringify(rows))

@alsotang 可以啦,谢谢你,非常感谢

回到顶部