Home › Forums › Add-ons › Repeater Field › Help with a $wpdb MySQL Query › Reply To: Help with a $wpdb MySQL Query
It depends on how you want the subfields to show up. Here’s an example if you want to show any subfields with certain value:
$rows = $wpdb->get_results($wpdb->prepare(
"
SELECT *
FROM {$wpdb->prefix}postmeta
WHERE
( meta_key LIKE %s AND meta_value = %s) OR
( meta_key LIKE %s AND meta_value = %s)
",
'colours_%_colour', 'red',
'images_%_type', 'type_3'
));
You can combine it with any keys and values you want. To learn more about the AND
and OR
syntax, please take a look at this page: http://www.hackingwithphp.com/9/3/13/multiple-where-conditions.
Also, I’m afraid this is a MySQL topic. For further support, please visit WordPress support forum or MySQL community instead.
Thanks 🙂
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.