Sorry for my english !!!
I get data from a table wp_posts
and now I need to get data from the table wp_postmeta
that match the ID captured in wp_posts
table.
The data that I need to grab in the table wp_postmeta
are product_img1
, product_img2
, product_img3
as shown in image below.
This is a view of table wp_posts
.
I need to show ID
, post_title
, product_img1
, product_img2
, product_img3
and my SQL query is:
require("configs/conxao.php");
$datas = $pdo->query("SELECT p.ID, p.post_title, pm.product_img1, pm.product_img2,
pm.product_img3
FROM wp_posts p
JOIN wp_postmeta pm
ON p.ID = pm.post_id
WHERE p.post_type = 'wpcproduct'
");
$datas->execute();
while($donnees = $data->fetch(PDO::FETCH_ASSOC)){
How to show this data here?
}
Can you help me to show this data for ID 103?