【发布时间】:2015-04-18 07:10:30
【问题描述】:
我正在建造一家拍卖行。我正在使用 nodejs-mysql 包,我有这个 nodejs server.js-code 用于主页,显示多个拍卖:
// loop
var pollingLoop = function() {
// Doing the database query
var query = connection.query('SELECT a.`id`,a.`product_id`,a.`price`,a.`random`,a.`price_end`,TIMESTAMPDIFF(SECOND,NOW(),a.`date_end`) AS duration,p.`price_retail` FROM `auctions` AS a LEFT JOIN `products` AS p ON p.`id` = a.`product_id` WHERE TIMESTAMPDIFF(SECOND,NOW(),a.`date_end`) > "-1" ORDER BY `duration` DESC,`id` DESC'),
auctions = [];
- 当
$_GET['id']可用于具有WHERE条件的另一个SELECT语句时,如何更改此查询?因为我想添加WHERE auction='$_GET['id']'单次拍卖(但在服务器端)。 - 有没有办法让它更具可读性?因为当我按 ENTER 时,
SELECT-statement 根本不起作用。这就是它在 nodejs-server-fileserver.js: http://i.stack.imgur.com/37fDl.jpg 上的样子
【问题讨论】:
标签: javascript php mysql node.js