$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
- What is “Advanced” SQL?
- 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
- 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
- Custom form that store input in database
- WordPress Unit Testing – Cannot Create Tables
- How to define composite keys with dbDelta()
- Insert data in database using form
- Does wpdb add considerable overhead on queries with large result sets?
- 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
- Connect forms in WP to external database
- Hook into $wpdb
- How does $wpdb handle COUNT(*)
- Organizing WP Pages based on old website database
- How might I retrieve a featured post image from an external WP site and display it as a link back?
- WordPress database error: [Query was empty] [closed]
- Export wordpress table to excel
- How to close wpdb connection? [duplicate]
- Why does dbDelta() not catch MysqlErrors?
- Connecting to external oracle database
- Bulk Update of Custom Post Type Post Status through SQL
- How do I add indexes to WordPress Database?
- Moving an entire wordpress site from one domain to a new domain and database
- Change SQL get_results to search for posts with custom term in custom taxonomy
- Can’t save ajax value to database
- What causes the “max_user_connections” warning on WordPress frontend?
- Storing textbox values in Database
- $wpdb variable throw this error Call to a member function get_results() on a non-object in
- Updating all rows of table with $wpdb
- Block search SQL from happening
- WPDB: how to get the value of a field in a custom database table
- wpdb query on custom table not working [closed]
- Safe way to find last inserted id in a table?
- Store and Encrypt Contact Form 7 Submissions in Database? [closed]
- Delete duplicate rows from wordpress database where a column is duplicate in phpmyadmin
- Is $wpdb->prepare escaping to much? How to use it properly?
- Database slowdown after update to 3.4.1
- When and why should I use $wpdb different return types?
- Query WordPress database by registered date and role
- How wordpress accesses its own database
- Using table lock with wp_insert_post?
- Remove database entries where post_date > expiration date
- Error connecting to DB in /wp-includes/wp-db.php on line 1538 [closed]
- Scheduling posts in database
- Size article thumbnails and retrieve them directly from database
- How To Get Some Data From WordPress Database Using WordPress $wpdb Query?
- Get data from database using $WPDB
- How to use a different database to list and manage comments in the backend
- Getting all the users who have author privilege
- Multiple postmeta with same name for one post in wp_postmeta table
- WP Database Table to CSV file
- Cannot update custom database table row
- Show last modified date of database
- Uppercase to sentence case for post titles
- $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
- In what part of the WordPress core does the users table and usermeta table get joined?
- WordPress and MySQL: how to transfer Meta_key and Meta_Value from one post_id to another
- Modify Database in Multi-Site wp_usermeta table
- Form Data not getting stored in WordPress database
- How do I get the posts within a certain year/date(with sql query)?
- Multiple wp_options tables to share content across installs
- Advanced SELECT query with condtional statements
- $wpdb doesn’t like to store arrays
- Select two sums with single get_var statement
- Export / import WordPress database