This commit is contained in:
Olu Amey
2021-08-23 11:56:20 -04:00
parent 1e0ee733ea
commit 351e31d0d8
+5 -1
View File
@@ -71,7 +71,11 @@ app.get('/', function (req, res) {
// client.end()
// })
con.query("SELECT * FROM wp_mermsemrusers", function (err, result, fields) {
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";
con.query(findPostsQry, function (err, result, fields) {
// if any error while executing above query, throw error
if (err) throw err;
// if there is no error, you have the result