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
- Get error messages when $wpdb->insert() returns false?
- How to fetch Data in WordPress using MySQLi or $wpdb
- How to define composite keys with dbDelta()
- Does wpdb add considerable overhead on queries with large result sets?
- $wpdb->prepare() warning in WordPress 3.5
- Hook into $wpdb
- Performance tips for a large user base [closed]
- How to auto login user again after change user_login
- Getting users who registered 360 days from current date
- Querying Email Addresses for a List of Users with Same Last Name?
- Connecting to external oracle database
- Bulk Update of Custom Post Type Post Status through SQL
- How do I add indexes to WordPress Database?
- Can’t save ajax value to database
- $wpdb variable throw this error Call to a member function get_results() on a non-object in
- Extend the wp_users table
- Updating all rows of table with $wpdb
- Block search SQL from happening
- Is $wpdb->prepare escaping to much? How to use it properly?
- Remove database entries where post_date > expiration date
- How to use a different database to list and manage comments in the backend
- $wpdb->insert is not working
- Why is it that not all users have a ‘session_tokens’ meta_key record in the usermeta table?
- WordPress and MySQL: how to transfer Meta_key and Meta_Value from one post_id to another
- wp_get_current_user always returns 0 continued
- How can i customize the export personal data file?
- Import users from old WP site to new one
- $wpdb->insert Giving duplicates
- Convert user passwords to MD5?
- Which data is written and stored in the database when read-only (non-posting, non-commenting) users visit the site?
- multiple wordpress installation with shared usertable on an different database
- Is it possible to have more than 1 MySQL database in my WordPress blog?
- How to fetch records from database WordPress
- AJAX wp-mysql running too slow
- Some weird users in database
- Is my way to change WordPress server is correct?
- Delete/Replace words from X to Y in post content
- Query Column of Specific ID from Database Table
- Get emails from users by custom field SQL
- How to create more than one new wpdb object?
- Recovering the table wp_usermeta from users
- Update multiple rows in one query
- Regenerate user_nicename column
- access JSON results from wordpress database with wpdb
- wpdb->insert not inserting first variable
- How do I have a user upload a blog post and then retrieve that to display in a card on the site?
- custom tables in wordpress Database? (can i just create them with sql?)
- Accidently changed the GUID
- How do I get database rows from a custom table using wpdb?
- DB prefix not updating
- How to get image path from id using SQL
- User input to database
- Change user_nickname for author page link
- how restrict user to give star ratings once for a post?
- create a table using user meta custom data
- How to add download link from database on custom page template?
- How to set posts to draft in bulk based on the content of the post
- How to create index (sql) to a meta_key?
- How to get the id of recently registered user from database?
- insert data from a form:: Warning Empty query mysqli::query()
- 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
- Call to a member function insert()
- Changed meta_key value in structures, now dashboard shows zero users
- Link wordpress with a SQl + MongoDB + .NET
- Pulling values from a sepcific row in table
- How to add data from wordpress tables to new database tables you have created
- import (migration) user database to wp-users
- Creating Tables in WordPress Database
- Inserting into data into external DB using WPDB
- Insert Extra fields added in the front end registration form to DB
- export individual posts to text files or a single csv file
- $wpdb->insert not working for last select option
- $wpdb->prepare returns empty array
- How to create a table that interact with database in real time
- SQL query to rewrite all media URLs to end with .webp
- WP Multisite Users Not Linking
- Weird WP -Cli Error Connection Refused