Note that you may need to use WPDB::prepare() to prevent against SQL injections. Although, it might be arguable in your specific case…
// If the query does not work, ensure the table name is correct...
$table = $wpdb->prefix . 'SaveContactForm7_1';
$reservations = $wpdb->get_results(
$wpdb->prepare(
"SELECT * FROM $table WHERE user = %s",
$username
)
);
See WPDB class reference. Hope this answers to your question.
Related Posts:
- How to delete a particular row in a database table
- WPDB Insert or if exists Update
- Display data from a non wordpress database on a page template
- Inserting Post Meta From SQL
- How to execute mulitple statement SQL queries using $wpdb->query?
- How to query the WordPress database to get posts of a certain custom post type, taxonomy and field?
- Getting all the users who have author privilege
- wpdb_prepare with multiple or condition
- In what part of the WordPress core does the users table and usermeta table get joined?
- Modify Database in Multi-Site wp_usermeta table
- Create table from array with prepare
- WPDB SQL query with prepare() returning variable, not db value
- Best practice to import user base (subscribers) from one website to another?
- Clear Terms from Taxonomy for Specific Post IDs?
- Getting value from database table depending on field value
- Select From wpdb – Author/User Directory page
- Help posting values to DB on submit using $wpdb->query
- 2 $wpdb queries causing error Table ‘wp_postmeta’ is specified twice, both as a target for ‘UPDATE’
- Correct and secure way to access a custom SQL database in a custom PHP template file
- Oracle SQL query for Date format
- Using wpdb to connect to a separate database
- get_results using wpdb
- $wpdb won’t insert NULL into table column
- wpdb->insert multiple record at once
- How to define composite keys with dbDelta()
- Hook into $wpdb
- How does $wpdb handle COUNT(*)
- WordPress database error: [Query was empty] [closed]
- Efficiency on displaying random authors based on large database
- Change SQL get_results to search for posts with custom term in custom taxonomy
- wpdb query on custom table not working [closed]
- Store and Encrypt Contact Form 7 Submissions in Database? [closed]
- When and why should I use $wpdb different return types?
- How wordpress accesses its own database
- Using table lock with wp_insert_post?
- Error connecting to DB in /wp-includes/wp-db.php on line 1538 [closed]
- Set Display Name to first and last name (phpmyadmin SQL Query)
- How To Get Some Data From WordPress Database Using WordPress $wpdb Query?
- How to use a different database to list and manage comments in the backend
- Cannot update custom database table row
- Show last modified date of database
- $wpdb->insert is not working
- SQL Error wp_commentmeta – incorrect table definition
- Extracting the post_id via the wp_insert_post action (external db query)
- WordPress database error – Error in SQL syntax – I can’t identify any error?
- Why is it that not all users have a ‘session_tokens’ meta_key record in the usermeta table?
- Change WordPress prefix for only one table?
- How do I get the posts within a certain year/date(with sql query)?
- Multiple wp_options tables to share content across installs
- Select two sums with single get_var statement
- How can i add custom fields into the contact form 7 [closed]
- Is there a smart way to obtain a list of only some selected user meta data?
- Update from 4.5 to 4.6 failing
- Setup private content for specific users with daily updates [closed]
- MS Access to manage WordPress Database
- Have working sql query… trying to adjust it to use $wpdb
- Does WordPress store the username as a primary key in the database?
- $wpdb->query can’t insert data
- Custom WordPress Table wpdb
- Why this query is not showing any result on wordpresss home page?
- Best practice to limit results in get_row()?
- How to migrate a database from a server to another
- CreateOrUpdate in WordPress
- Problem migrating to localhost
- Trouble running $wpdb->query() with last_insert_id
- How to get a list of WordPress default database tables?
- Using $wpdb | checking entered email against existing emails in db
- SQL query to set posts in bulk based on the post content
- Delete all posts that do NOT have a specific tag
- Optimizing function that automatically creates internal links based on post title string
- Get results from wordpress data custom table
- Outputting query results
- WordPress where clauses in db select
- How to display data from db in select list [closed]
- Creating and Using Tables in the WordPress Database
- How to escape percentage sign(%) in sql query with $wpdb->prepare?
- SELECT rows between two datetimes when the range is dynamic [closed]
- How to insert a value to decimal type field using wpdb->prepare?
- Sql query to get all metadata for a post
- Migrate Users From laravel to wordpress
- I wanted to Know that how can I give ingore to 0000-00-00 in my config file
- Job and Employee Performance Tracking with Product Safety
- how add more field to wp user and save it to database
- SQL database import #1046 error
- How do I loop/iterate through posts to edit all img tags?
- Where is the HTML-handler part in the wpdb class?
- Is there a way for two deferent themes to consume two different DB on a same WP instance?
- How can I get $wpdb to show MySQL warnings?
- About wp database hooks (error establishing connection)
- The MySQL Connection could not be established., before it was joomla but i have change it into worpress
- Should I Use only wpdb Class to Write Custom Queries?
- Include post_status check within $wpdb query
- Hash user emails in database?
- using same mysql user with many databases
- Get id from database
- How can I retrieve data from alternate database using wpdb class?
- Import Excel (or csv) Table with user-data as subscribers to wordpress
- Migrated to Namecheap, now Trouble with Database & wp-config [closed]
- SQL query : Select a thumbnail for a media
- How to delete field using WPDB?