How to get the post_id from postmeta

Question

i am trying to fetch the post_id from the wp_postmeta table, here is the code im using:

 if(isset($_POST['patientid'])) { //user enters the patientid

        $thevalue = $_POST['patientid'];
        $tbl = $wpdb->prefix.'postmeta';

        $prepare_guery = $wpdb->prepare( "SELECT post_id FROM $tbl WHERE meta_key ='patientid' AND meta_value LIKE $thevalue", $meta_value );

        $get_values = $wpdb->get_col( $prepare_guery );
        echo $get_values;
     }

but this only prints out “Array”, thats it. Can anyone please tell me what i should change? thank you!

--------------------------------------------------

>>> Share a link to this question, just copy and paste the code bellow on your web page <<<

<a href="https://www.wptricks.com/question/how-to-get-the-post_id-from-postmeta/">

How to get the post_id from postmeta</a>
0
, lenhe 2 months 0 Answers 25 views 0

Leave an answer