I
I
Issue2021-09-24 10:32:18
SQL
Issue, 2021-09-24 10:32:18

How to get SQL table data by multiple conditions?

Can't get table data in WP, what did I write wrong?

SELECT `meta_value`
FROM {$wpdb->postmeta}
WHERE `post_id`={$post->ID}
AND `meta_key`={$post->meta_key}

meta_value - you need to get data from the
$wpdb->postmeta column - table name
post_id - if the post ID is equal
to meta_key - and if it is equal to the value So...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
ThunderCat, 2021-09-24
@ThunderCat

the first thing to do is to separately generate and display a request, after that, firstly, you will see what got there, and secondly, you can insert the script into the console or into the phpmyadmin and execute, maybe there is stupidly no such data there.
The output of errors and warnings is also needed so that it is clear in general what and where does not work correctly.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question