0
SELECT總是顯示我undefined
在輸入文本未定義SELECT查詢+的NodeJS玉
路線:
exports.edit = function(req, res){
var id =(req.params.id);
customer = db.getCustomerById(id,function(results){
res.render('customer/edit', {customer: results });
});
};
DB函數:
exports.getCustomerById = function(id,callback){
var objBD = BD();
objBD.query('SELECT * FROM user WHERE id=? ', id, callback);
};
Edit.jade:
form(id='form', method='POST', action='/customer/edit/#{customer.id}')
input(type='text', id='name', name='name' value='#{customer.name}')
input(type='email', id='email', name='email' value='#{customer.email}')
input(type='tel', id='phone', name='telephone' value='#{customer.phone}')
哪些是您使用的是使數據庫查詢模塊? –
@LeonelMachava mysql – rokirakan78
好的。請看我的答案。 –