I'm building an auction house. I'm using the nodejs-mysql package and I have this nodejs server.js
-code for the main page, where multiple auctions are displayed:
// 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 = [];
- How can I accomplish that this query is changed when a
$_GET['id']
is available to anotherSELECT
-statement with aWHERE
-condition? Because I want to addWHERE auction='$_GET['id']'
for a single auction then (but server-side). - Is there a way to make it more readable? Because when I press ENTER the
SELECT
-statement won't work at all. This is how it looks on the nodejs-server-fileserver.js
: http://ift.tt/1ORW9NW
Aucun commentaire:
Enregistrer un commentaire