You need to define $wpdb
as global.
Try this code.
global $wpdb;
$mail = $_POST['email'];
$table = $wpdb->prefix . 'members';
$result = $sql->get_results( "SELECT * FROM $table WHERE email = %s", $mail);
Related Posts:
- $wpdb-prepare : Do I have to bind a parameter to the table name?
- How to check if page has status published
- Triple meta_key on custom SELECT query
- MySQL Rank & $wpdb
- wp_Qwery works to slow
- How to get last user with wpdb?
- Read post meta values, only if posts are public
- ACF Pro select field problem [closed]
- Custom select query two tables by a meta key
- Get results from wordpress data custom table
- Select From wpdb – Author/User Directory page
- Database SQL query error
- SELECT rows between two datetimes when the range is dynamic [closed]
- How to search usermeta table
- Get 3 row ID’s via ARRAY_A
- Ajax Form data is not posted back to the get_results()
- wpdb select from using array as search parameters
- AJAX with Selectbox Plugins (Select2, Chosen, Selectize)
- Ajax Query returns zero
- Is there a way to select posts and print to a template page dynamically?
- Display the posts in a category with
- MySQL SELECT increment counter
- How do you properly prepare a %LIKE% SQL statement?
- How to correctly submit a search form and display the result in an independent page
- Using $wpdb to query posts with meta value containing current post_id
- WPDB Multiple site’s posts and get featured images
- How to select one major category (or custom taxonomy) for a custom post type?
- Merging PHP download script into `functions.php`
- Want to filter only parent post in admin area
- get_query_var(‘paged’) giving same result
- $wpdb is get_results escaped
- Safe way to find last inserted id in a table?
- wpdb prepare: passing varible number of fields as second argument
- How to get a list of taxonomy terms which are being used only within certain post types?
- Wpdb query for comment meta for current post
- What’s the proper way to use a custom table? [closed]
- How to Modify this $wpdb query to accept an array of post statuses
- Multiple postmeta with same name for one post in wp_postmeta table
- Using $wpdb->update but confused on the WHERE in and SET
- WPDB Update using Conditional Arrays
- Get published posts and pages?
- What’s the purpose / logic of split_the_query in WP_Query->get_posts
- Make one query for adding entries to database
- WordPress select field – show current value?
- WSoD being caused by this piece of code
- Converting the_content string to an array?
- Creating mySQL procedure with $wpdb
- Display custom fields from custom posts in RSS feed
- How to Instantiate wpdb Object in New File
- Return terms from multiple taxonomies using $wpdb
- How WordPress reacts to a lack of memory of the server [closed]
- Optimizing WordPress Queries – Removing Group By ID
- External DB Connection [closed]
- $wpdb->insert() does not Insert record in a table
- custom hooks before a comment is updated/edited in the database
- Custom query: Get all posts that are from a certain category?
- $wpdb error (Call to a member function insert() on a non-object)
- Custom Query based on custom field of a single post
- WordPress db prepare
- Can’t update multiple rows with $wpdb query
- how to get db values without using an loop with wpdb->get_results()
- Mixing variables into an array when inserting values
- paginate_links on custom query in admin – ‘sufficient permissions’ error
- get_results query with accent
- Output: “Array”
- Is querying wpdb directly and skipping actions provided by WP’s core “wp_update_post” a good idea?
- Delete database record using plugin from admin panel
- Using “->” in a page to exceute $wpdb query gives error
- How to get product order by two custom taxonomy in wordpress
- Why is this $wpdb query looping 5 times?
- wpdb query not returning results containing single quotes
- form $_post action value gets truncated after it passes through two forms
- Making jQuery .change() event persistent after widget save
- Updating with $qpdb->query() always returns 0 rows affected
- duplicate entries in database while using save_post or wp_insert_post
- WP MS: How to query over the network
- $wpdb is queried but results don’t show
- Plugin to create Posts and Forums then choose category and parent forum
- when using $wpdb sudden connection rejection without changing anything. Access denied, with errors from repair tool
- sort title descending with title with number
- How to have differents sites share the same tables of DB?
- Using external DB within wordpress
- Get last element from wpdb as a string
- Optimising amount of calls to custom fields
- Update all fields of table with ON DUPLICATE KEY UPDATE command
- WordPress – wpdb query does not list same result as sql query
- What is the best practice to initialise $wpdb by loading wp-load.php?
- wpdb->insert adds too many rows
- Search Query that Includes Custom Table
- Querying multiple meta_keys in WordPress SQL query
- WordPress plugin tables become corrupt
- $wpdb returns no results with SELECT query on custom post type, works on default post type
- Jeditable Plugin working as it should – scope issue?
- Fixing plugin for wpdb::prepare
- how to use transient method?
- Issues on saving data from CPT select metabox
- How to dispaly post informations (such as titles) in an admin plugin menu page?
- WordPress shortcode select option not working [closed]
- How to create a fully functional user registration in WordPress?
- Table wont load into WPDB