Use $wpdb->insert()
to safely insert data into a custom table in the WordPress database.
global $wpdb;
$table_name = $wpdb->prefix . 'my_custom_table'; // Replace with your custom table name
$data = array(
'column1' => 'value1',
'column2' => 'value2',
);
$format = array('%s', '%s'); // Define data types (%s for strings, %d for integers)
$wpdb->insert($table_name, $data, $format);