$wpdb->get_results()
returns an index array of row objects, but it looks like you’re expecting $exists
to contain the actual value of the used column. you probably want $wpdb->get_var()
: http://codex.wordpress.org/Class_Reference/wpdb#SELECT_a_Variable
Related Posts:
- How to use $wpdb to delete in a custom table
- get_results on large datasets
- Is there a (better) way to access $wpdb results?
- Using $wpdb generates DB error
- How do you use prepare when asking for a list of id’s
- how to execute different sql query in non-sanitized $wpdb->get_results function
- WPDB update row with != in where clause
- How to update records using $wpdb?
- Need help writing a $wpdb query
- show badge with count for pending items in custom post type
- WP Sql query multiple where clause
- Modify the structure of data returned by $wpdb
- Syntax for $wpdb->prepare when searching in two columns
- Confused by $wpdb->prepare
- How to display user_nicename and usermeta values by custom query in WordPress?
- Optimizing WordPress Queries – Removing Group By ID
- How can I combine one field using wpdb and group by?
- $wpdb->prepare with ON DUPLICATE KEY UPDATE
- how to use $wpdb->prepare to update a custom table
- WPDB Placeholders and second argument for prepared statements
- Increment integer field in database when WHERE needs to be dynamic [closed]
- Custom SQL query ORDER BY term_order
- Custom $wpdb returns unexpected time based results
- How to left join meta in queries [closed]
- wpdb->get_row is selecting the variable as a column name
- CREATE TABLE with dbDelta does not create table
- $wpdb query outputs php code instead of executing it
- wpdb query not working
- WordPress wpdb->insert returns int(0) => doesn’t insert anything, no errors!
- WPDB SQL Ignore `post_status` Parameter
- how to list all post that are in the custom taxonomy using $wpdb
- WPDB SQL query SELECT from category
- How to use WHERE NOT EXISTS query to avoid duplicate entry using $wpdb to save in custom table?
- Creating an Angular factory from custom database table
- wpdb->update update the entire table instead of one row
- How do I update post based on meta_key in another table?
- How to set up prepared query using IN statement
- Custom database query to validate data
- Alter the main search query to search posts by coauthor user name
- Creates only one table and not the other
- Protect custom form from SQL injection
- looking for a way to allow users to backup the plugin db data(save as)
- SQL Query to select post title & post ID from a particular category
- Get comments after specific date
- query using wpdb in wordpress gets me no result
- Get count of rows based if column exists in two different tables
- query_vars doesn’t return query string (trying to get data from $wpdb)
- $wpdb->get_row() only returns a single row?
- what is the way to see the currently executing query in wordpress?
- $wpdb->last_error doesn’t show the query on error
- Multipart/formatted MySQL query problem
- How to make an activities stream mixing posts and comments?
- Delete/replace img tags in post content for auto published posts [closed]
- What does wp_update_post() do that the $wpdb class does not?
- wpdb-> not adding prefix to custom table
- $wpdb prepare issue with mysql DATE_FORMAT
- How-To: wpdb Insert Record With Date
- WPDB: how to get the value of a field in a custom database table
- Get random row from custom table
- How to save html and text in the database?
- XOR functionality for meta_query
- How can I migrate mysql_fetch_array to $wbpdb?
- What is _transient_random_seed for?
- wpdb get_results() and prepare when to use prepare?
- Foreach loop using $wpdb not results from rows
- How to get a value-only flat array from $wpdb->get_results when selecting a single column, without foreach()?
- How to update a row in a table in WordPress
- What’s the proper way to add users to my site in order to test things?
- Q: How to pull data from custom table to populate zustomizer setting/control select options
- Code only works every other time its run
- I can’t figure out what’s wrong with this statement. $wpdb->query update
- Can’t pass variable in wordpress wpdb->get_results
- $wpdb->prepare with LIKE returning blank array instead of rows
- How do I count columns on a custom WPDB query?
- Trouble inserting string containing quotations marks with wpdb in save_post hook
- Set MySQL variables in WPDB
- How can I add a new row in a separate database when someone registers via WordPress?
- Clear Terms from Taxonomy for Specific Post IDs?
- $wpdb->insert() doesnt work anymore
- Where can I see MySQL hostname and port for wp-config.php
- Exclude specific terms from all queries using posts_where or something similar
- $wpdb->get_results not returning an array
- WPDB Query Question with Category Only
- wpdb result arrray inside an array
- Fetching review value using wpdb class
- $wpdb->num_rows doesn’t work
- How can I change my meta_query to SQL wpdb query?
- Database SQL query error
- How capturate wpdb exceptions?
- Limit left join
- Get records from Formidable Table using $wpdb->get_col
- What argument does my function need to echo get_results() query results
- Missing argument 2 for wpdb::prepare() [duplicate]
- Save customizer default values to DB on theme activation
- Plugin with connection to database – Single function
- wpdb->update error
- Wpdb generates too many queries
- Using $wpdb to update current post
- DBDelta: “table doesn’t exist” for a table that was just created
- WP Recommended Table Exclusions?