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
- What is “Advanced” SQL?
- Oracle SQL query for Date format
- Using wpdb to connect to a separate database
- Multiple developers / editors working on a site in progress
- get_results using wpdb
- $wpdb won’t insert NULL into table column
- How many users can WordPress handle?
- Get error messages when $wpdb->insert() returns false?
- Detecting errors generated by $wpdb->get_results()
- Does dbDelta delete columns as well?
- wpdb update add current timestamp not working
- How to fetch Data in WordPress using MySQLi or $wpdb
- wpdb->insert multiple record at once
- WordPress Unit Testing – Cannot Create Tables
- How to define composite keys with dbDelta()
- Does wpdb add considerable overhead on queries with large result sets?
- How to track user progress?
- Why does $wpdb return strings for mysql integer values?
- $wpdb->prepare() warning in WordPress 3.5
- Where are image paths to product category images stored in WordPress database
- Sharing database for collaborative development
- Inserting data into custom tables
- Hook into $wpdb
- Delete all users meta that named: user_avatar
- How to get the id of recently registered user from database?
- insert data from a form:: Warning Empty query mysqli::query()
- How can I get $wpdb to show MySQL warnings?
- How to save dropdown slection by a user in the DB
- About wp database hooks (error establishing connection)
- Using $wpdb to insert data into a table
- The MySQL Connection could not be established., before it was joomla but i have change it into worpress
- How to retrieve user data based on role using SQL?
- update multiple user meta field based on another meta field
- $wpdb not working
- How To connect to the same WordPress database with different database user
- Accessing content from third party as native posts in WordPress
- WordPress character set issue
- Should I Use only wpdb Class to Write Custom Queries?
- Call to a member function insert()
- I have include wp-config, should I add global $wpdb also?
- Include post_status check within $wpdb query
- Processing a lot of $wpdb isn’t insert all the data
- Can’t Install WordPress (local) Failed to open file wp-includes/wp-db.php
- Hash user emails in database?
- Changed meta_key value in structures, now dashboard shows zero users
- Link wordpress with a SQl + MongoDB + .NET
- What WordPress file is saving new users to database
- using same mysql user with many databases
- Get id from database
- How can I retrieve data from alternate database using wpdb class?
- WordPress sync with phpbb
- Pulling values from a sepcific row in table
- How to add data from wordpress tables to new database tables you have created
- Querying multiple meta_keys in WordPress SQL query
- import (migration) user database to wp-users
- Creating Tables in WordPress Database
- Import Excel (or csv) Table with user-data as subscribers to wordpress
- Inserting into data into external DB using WPDB
- Getting deleted users in database
- Install WordPress with SQL database
- Insert Extra fields added in the front end registration form to DB
- How to use remote db tables in current config? [duplicate]
- Migrated to Namecheap, now Trouble with Database & wp-config [closed]
- export individual posts to text files or a single csv file
- $wpdb->insert not working for last select option
- SQL query : Select a thumbnail for a media
- $wpdb->prepare returns empty array
- How to delete field using WPDB?
- How to create a table that interact with database in real time
- why you don’t Implement PDO for access every thing to database
- SQL Query to get post_id from wp_posts and and meta_key(s) from wp_postmeta
- SQL query to rewrite all media URLs to end with .webp
- WP Multisite Users Not Linking
- Weird WP -Cli Error Connection Refused
- Uploading to WordPress Database
- $wpdb->update is not working until next page refresh. Is there one more step?
- #1067 – Invalid default value for ‘post_date’ when trying to create a new column
- how to run tests using different db connection
- Deleting WordPress posts and media files based on author via MYSQL database
- SQL errors when querying for something with apostrophes
- Database table prefix different between wp-config.php and in database