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
- Selecting multiple columns in a Pandas dataframe
- How do I UPDATE from a SELECT in SQL Server?
- SQL SELECT WHERE field contains words
- SQL query to get the employee name and their manager name from the same table
- SQL SELECT WHERE field contains words
- Select objects based on value of variable in object using jq
- SQL SELECT WHERE field contains words
- ORA-01843 not a valid month- Comparing Dates
- SQL update from one Table to another based on a ID match
- MySQL SELECT increment counter
- Best way to do nested case statement logic in SQL Server
- ORA-01830: date format picture ends before converting entire input string / Select sum where date query
- MySQL “Or” Condition
- MySQL – UPDATE query based on SELECT Query
- How to write a SQL DELETE statement with a SELECT statement in the WHERE clause?
- Create a temporary table in a SELECT statement without a separate CREATE TABLE
- SQL: Two select statements in one query
- grant select on view
- SQL conditional SELECT
- MySQL Select Multiple VALUES
- DATEDIFF function in Oracle
- MySQL error: Unknown column in ‘where clause’
- Postgresql column reference “id” is ambiguous
- How to order by column A and then by column B?
- Using wpdb to connect to a separate database
- How do you properly prepare a %LIKE% SQL statement?
- How to print the excuted sql right after its execution
- $wpdb->get_row() only returns a single row?
- Should I use wpdb prepare?
- WPDB Insert or if exists Update
- Query to sort a list by meta key first (if it exists), and show remaining posts without meta key ordered by title
- Showing errors with $wpdb update
- How to return number of found rows from SELECT query
- How to use wp_nav_menu to create a select menu dropdown?
- Is it mandatory to use $wpdb->prefix in custom tables
- wpdb->insert: do I need to prepare against SQL injection?
- get_results using wpdb
- How to programatically change username (user_login)?
- Contact form 7 select box different value-text than content-text in option [closed]
- $wpdb won’t insert NULL into table column
- How to parse row results from $wpdb -> get_results
- Why $wpdb->show_errors() and print_error() is showing an output even if the query output is correct?
- what is the way to see the currently executing query in wordpress?
- Fetch array with $wpdb
- How do I check for a duplicate record before inserting using wpdb
- Pagination with custom SQL query
- Get error messages when $wpdb->insert() returns false?
- Return only Count from a wp_query request?
- Detecting errors generated by $wpdb->get_results()
- Does dbDelta delete columns as well?
- WordPress 4.8.1 uses mysql_connect which doesn’t work with PHP 7
- wpdb update add current timestamp not working
- How to fetch Data in WordPress using MySQLi or $wpdb
- How to use $wpdb to delete in a custom table
- $wpdb->insert not working in any way
- WPDB prepare – like % – placeholders?
- How to delete all records from or empty a custom database table?
- dbDelta only creates the last table
- WordPress Paginate $wpdb->get_results
- wpdb->insert multiple record at once
- Differences between wpdb->get_results() and wpdb->query()
- $wpdb->insert_id
- Can i use php sql functions instead of $wpdb?
- Does a query executed through wpdb class get cached?
- $wpdb->update multiple rows, like IN in normal SQL
- What are the differences between wp_users and wp_usermeta tables?
- What is the best way to sanitize data?
- Matching database content types to PHP types
- $wpdb->get_results(…) returns empty array despite correct query
- Assign a Class to the Current “Tag” for Formatting
- Does $wpdb->prepare not create a prepared statement that I can execute multiple times?
- WordPress Unit Testing – Cannot Create Tables
- Use wpdb->prepare for `order by` column name
- How to define composite keys with dbDelta()
- get_results on large datasets
- Does wpdb add considerable overhead on queries with large result sets?
- $wpdb->insert() and Values for Datetime Columns?
- How to correctly submit a search form and display the result in an independent page
- SELECT max(meta_value) FROM wp_postmeta WHERE meta_key=’price’… stops working when value is over 999