Sorry 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 my wp_posts:
I need to show ID, post_title, product_img1, product_img2, product_img3 and I am the SQL:
$show_info = $pdo("SELECT p.*, pm.*
FROM wp_posts p
JOIN wp_postmeta pm ON p.post_id = pm.meta_id
WHERE p.post_type = 'wpcproduct'"
);
Can you help me to show this data for ID 103?
I think the correct query for you is:
Since you want to match the
post_id
column on thewp_postmeta
with theID
column on wp_postsIf you only want data from post id 103, do:
If you only want to display some columns, then do the following: