$wpdb has an insert method, so you can try the following:
$table="wp_email_subscribers";
$data = array(
'first_name' => $firstname,
'last_name' => $lastname,
'email'=> $email ,
'gdpr_consent'=>$gdprconsent
);
$format = array('%s','%s', '%s', '%s');
$wpdb->insert($table,$data,$format);
var_dump($wpdb->insert_id);
Related Posts:
- Getting value from database table depending on field value
- WPDB Insert or if exists Update
- Inserting data into custom tables
- 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?
- wpdb_prepare with multiple or condition
- Create table from array with prepare
- WordPress running SQL query to update database from form
- Insert Query not working in the form
- WPDB SQL query with prepare() returning variable, not db value
- Clear Terms from Taxonomy for Specific Post IDs?
- Using $wpdb | checking entered email against existing emails in db
- How to delete a particular row in a database table
- 2 $wpdb queries causing error Table ‘wp_postmeta’ is specified twice, both as a target for ‘UPDATE’
- insert data from a form:: Warning Empty query mysqli::query()
- Correct and secure way to access a custom SQL database in a custom PHP template file
- How to get specific table by current user login
- $wpdb not working
- Insert Extra fields added in the front end registration form to DB
- 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()
- Connect forms in WP to external database
- Hook into $wpdb
- How does $wpdb handle COUNT(*)
- WordPress database error: [Query was empty] [closed]
- Connecting to external oracle database
- Bulk Update of Custom Post Type Post Status through SQL
- How do I add indexes to WordPress 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]
- 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?
- Retrieving a Value from a wp-database
- 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
- Sending data with multi step form to wp database
- Retrieve data from the database to table such as comments in the admin control panel
- Update from 4.5 to 4.6 failing
- Setup private content for specific users with daily updates [closed]
- $wpdb->insert Giving duplicates
- Which data is written and stored in the database when read-only (non-posting, non-commenting) users visit the site?
- Have working sql query… trying to adjust it to use $wpdb
- $wpdb->query can’t insert data
- Custom WordPress Table wpdb
- 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
- CreateOrUpdate in WordPress
- Problem migrating to localhost
- Is my way to change WordPress server is correct?
- How to get a list of WordPress default database tables?
- Delete/Replace words from X to Y in post content
- SQL query to set posts in bulk based on the post content
- Delete all posts that do NOT have a specific tag
- Creating and Using Tables in the WordPress Database
- How to escape percentage sign(%) in sql query with $wpdb->prepare?
- DB prefix not updating
- How to insert a value to decimal type field using wpdb->prepare?
- Whats the best practise on how to store json data from a custom settings page?
- Sql query to get all metadata for a post
- 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
- User input to database
- SQL database import #1046 error
- Change user_nickname for author page link
- 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 to add download link from database on custom page template?
- How to create index (sql) to a meta_key?
- How can I get $wpdb to show MySQL warnings?
- About wp database hooks (error establishing connection)
- Accessing content from third party as native posts in WordPress
- Should I Use only wpdb Class to Write Custom Queries?
- Auto populate form fields based on serial input or pull listings from other websites?
- Include post_status check within $wpdb query
- using same mysql user with many databases
- Simple email input store in database
- Pulling values from a sepcific row in table
- Migrated to Namecheap, now Trouble with Database & wp-config [closed]
- export individual posts to text files or a single csv file
- Saving data to database and exporting to excel
- $wpdb->insert not working for last select option