<?php
global $wpdb;
$table_name = $wpdb->prefix . "postmeta";
$login_name = sanitize_user( $_POST['parent_id'] );
$prepare = $wpdb->prepare( "SELECT COUNT(*) FROM $table_name WHERE meta_value="Purva" AND meta_key = 'parent_id' ", $login_name );
$myrows = $wpdb->get_results( $prepare );
echo '<pre>' . print_r( $myrows, true ) . '</pre>';
?>
I tried this and get values but still something missing…
Related Posts:
- Use have_posts() with array of post results retrieved by $wpdb->get_results
- Custom query (author is post_author or meta co_author) with Pagenavi pagination
- get_post_meta bringing back results, but $wpdb->postmeta doesn’t
- How to print the excuted sql right after its execution
- Return only Count from a wp_query request?
- WP Query Args – Title or Meta Value
- Does tax_query really beats meta_query in all situations?
- Query WooCommerce orders where meta data does not exist
- Execute a large WP_Query with many “AND” Meta_Queries?
- Query all posts where meta value is empty
- WP_Query min and max values
- WP_Query using meta_query with relation OR and orderby meta_value doesn’t work
- querying with custom meta field with meta_query
- Finding all results from database within 500 miles of the given latitude and longitude [closed]
- Use meta_query to display events by date in custom field
- How to show recent and upcoming birthdays using meta_query
- Multiple meta queries but arrange by specific meta value order
- Using WP_Query and WP_Meta_Query Outside of WordPress
- What format does the meta_query TIME type require?
- If two first numbers exist in wp_meta_query value
- WP_Query on custom field and order results
- pre_get_posts order by not working
- WP_Query filter and order by meta ordering by wrong joined table
- WP_Query last five posts, simply ordered by meta_value
- Tax query clause inside a meta query clause?
- What is the random string I am seeing when I use get_query_var?
- Optional Meta Query
- How do I make a meta_query OR relation work? [closed]
- Iterating through $wpdb query without using get_results for large query results
- meta_query in WP_Query value is not accepting array
- Meta_query on same meta key, with diffrenct values
- Can we return all category (not post) with Custom Query Filter? [closed]
- Extend product search with meta in WooCommerce
- how to make members list directory through wordpress post custom meta key.
- Changing sort order for presentation by Jetpack infinite scroll
- Filter and Order by Multiple Custom Meta Values
- Meta Query relation “AND” then set array accordingly
- How to query custom post types with mixed AND & OR statements for custom fields
- 2 weeks ago from meta query meta value
- WP_Query with meta_query dosen’t return results
- Query most popular terms by taxonomy over 2 week period
- Query with meta_query and tax_query together not working properly
- Array as ‘key’ in WP_Query
- Make a SQL query with wpdb in WordPress
- Filter posts by comparing custom meta value against postdate
- How to provide meta_key array to wp_query?
- Searching for meta_key returns 0 posts
- Specify strict ‘order by’ in WordPress query
- meta_query fails to compare on values containing apostrophes
- How to set up hierarchical relationships without using plugins / meta query
- Does WordPress have something like Drupal’s DB API?
- Check if searched number is within the post meta value
- Meta query compare for ID’s greater than specific ID
- Is it possible to add relation between meta_query and tax_query?
- add_query_arg to compare and display events from a certain date
- Show single posts date, in a page of posts
- WP_Query Class custom field parameters
- What’s wrong with this wpdb query?
- WP_Query not returning correct result with meta_query parameter
- meta_query where the meta value is not the post title
- Order WP_Query by meta_key priority when ‘OR’ relation used for multiple meta values
- How do i create a custom post query when the meta value is an array?
- Custom Meta Query doesn’t work the same on two site
- meta_query with meta values as serialize arrays
- Save queried result into database
- Woocommerce Get Orders By Meta Value
- meta_query is overriding default search
- Multiple WP_Query args combinations according to post type
- WP_Query multiple value not working
- How to do WP_User_Query for Nested Array value Inside Nested Array field
- Custom query to retrieve oldest post and retrieve others with date interval
- WP_User_Query Orderby Not Working
- Unusual high query of user meta data
- WordPress Query optimaization for slow query
- How to filter on placeholder image
- Slow wp_posts and wp_postmeta query using Advance Custom Fields
- Meta query doesn’t remove placeholder escape before query
- WP Query Meta Query
- Query custom meta value – post view and date meta
- Slow query when selecting with large meta query or post__in
- How can I modify standard search query to include also ACF custom fields values?
- Custom WP_query and integrating into theme file
- WP_Query – show posts where meta value and user_email match
- WP Meta Query at depth 2
- Best way to Order Post in Home without a plugin
- WP_Query using meta_query with LIKE doesn’t return what it should
- Return a single custom post from multiple meta queries
- Sorting: custom query with orderby meta_value_num THEN by title
- query post based on comparison
- Including ‘cat’ => $cat breaks meta_query
- Different sql queries count indicator on the main page [closed]
- Query string form $_GET[‘value’] is not working as meta value in wp_query
- Can’t figure out query logic
- Convert a WP Query into a simpler SQL query to fetch only COUNT of posts
- WP_Query orderby not working on custom post_type
- 294 Queries on Mainpage of WordPress
- Using ‘meta_query’ with the ‘pre_get_posts()’ hook disables searching for post titles
- Get posts using multiple values from ACF checkbox as meta query wordpress
- WP Query returning all posts when Meta_query is null
- Is there another way to retrieve a post_id from post_meta other than a SQL query?