I have a WordPress site and use Advanced Custom Fields. Now I want to get all values from a specified post (post_id). But my problem is that the plugin saves the values in "repeaters". So, if I have 3 prices for one post, I also have 3 different links to the product and 3 different shops.
My problem is that I do not know, if I make a SQL query, how many fields I have. I just know that the fields are called like this:
- product_shops_0_price
- product_shops_1_price
- product_shops_2_price
- and so so... with link, shops and everything else.
My question now is, what is the best way to get all values with a SQL query? - I do know the post ID. So all postmetas I get returned by where post_id = '$pid'
belongs to this post. But how do I get all prices, links and shops if I do not know how many there are?
EDIT: I do not have a problem to code my script. So, yet there is no code written. And that because I do not know how to select values with a SQL query. Here you can see a example of the postmetas from one post. This is just a snippet of 134 entries for this post.
My problem is, I do not know how I can register variable how many price, link and shop entries I have per post. Because some posts just contains 2 links, shops and prices, and some other posts contains 5 prices, links and shops.