This commit is contained in:
Olu Ameye
2021-08-23 16:30:16 +00:00
parent d23725a402
commit 068cef2f7e
+3 -2
View File
@@ -64,14 +64,14 @@ const price_list = [
app.get('/', function (req, res) {
res.status(200).send(price_list);
//res.status(200).send(price_list);
// client.query('SELECT * FROM members', (err, res) => {
// console.log(err, res)
// client.end()
// })
let findPostsQry = "SELECT p1.id AS id, p1.*, wm2.meta_value FROM wp_posts p1 LEFT JOIN wp_postmeta wm1 ON (wm1.post_id = p1.id AND wm1.meta_value IS NOT NULL AND wm1.meta_key = '_thumbnail_id' ) LEFT JOIN wp_postmeta wm2 ON (wm1.meta_value = wm2.post_id AND wm2.meta_key = '_wp_attached_file' AND wm2.meta_value IS NOT NULL ) WHERE p1.post_status='publish' AND p1.post_type='post' ORDER BY p1.post_date DESC LIMIT 9";
let findPostsQry = "SELECT p1.id AS id, p1.*, wm2.meta_value FROM wp_mermsemrposts p1 LEFT JOIN wp_mermsemrpostmeta wm1 ON (wm1.post_id = p1.id AND wm1.meta_value IS NOT NULL AND wm1.meta_key = '_thumbnail_id' ) LEFT JOIN wp_mermsemrpostmeta wm2 ON (wm1.meta_value = wm2.post_id AND wm2.meta_key = '_wp_attached_file' AND wm2.meta_value IS NOT NULL ) WHERE p1.post_status='publish' AND p1.post_type='post' ORDER BY p1.post_date DESC LIMIT 9";
@@ -80,6 +80,7 @@ con.query(findPostsQry, function (err, result, fields) {
if (err) throw err;
// if there is no error, you have the result
console.log(result);
res.status(200).send( [{payload: result}]);
});