How to get the post_id from postmeta


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!

, lenhe 11 months 0 Answers 46 views 0

Leave an answer