How do I join a $wpdb query with user meta using default value if not exist?
How do I join a $wpdb query with user meta using default value if not exist?
How do I join a $wpdb query with user meta using default value if not exist?
So i think I’ve found the answer to my own question. I modified the code in the original tablequerytest.php which queries the custom table and stores results from this: <?php global $wpdb; //Accessing WP Database (non-WP Table) use code below. $results = $wpdb->get_results(‘SELECT alias FROM wp_revslider_sliders’); foreach ($results as $result) { $revchoices = array(“text” => … Read more
wp query foreach deleting record returning only first or last item
I tried this in local, and I think you have multiple fields inside $fields so I’ve added them in array. Just look at the code below; it works fine as tested: add_action(‘your_hook’, ‘createTableFromFields’); function createTableFromFields($tablename) { $wpdb = $this->db; $tablename = $wpdb->prefix . $tablename; $fields = array(‘PersonID’,’LastName’); $sql=”CREATE TABLE IF NOT EXISTS %s (id INT(6) … Read more
Query with search and subscribers only output
Query insert query executing multiple times
How to do set post permalinks using 6 digit random unique function?
From your code, this is the part where you can get the mark, modified to get only one: $member_id = get_current_user_id(); $course_id = 1; //i am assuming the ID of the course $status = get_user_course_status($member_id,$course_id); if($status > 3){ $mark = get_post_meta($course_id,$member_id, true); echo $mark; }
wpdb php get_var query to get ID for URL image doesn’t work for ID over 999
$wpdb->replace: WHERE?