Im having problem to use this code for wordpress to insert data to the database

Hello, i’m having problem using this code to insert data to database, if i click the submit button , there is no respond, please help.

function submit_my_form(){
global $wpdb;
$table_name = $wpdb -> prefix.'my_tables_db';


	$CB_email = $_POST['email'];
	$CB_Client_ID = $_POST['client_id'];
	$CB_Client_Secret = $_POST['client_secret'];
	$CB_Client_Password = $_POST['password'];
	$CB_Client_TimeZone = $_POST['timezone'];

if(isset($_POST['submit'])){
	
 
$wpdb -> query(
       $wpdb ->prepare(
        "Insert into $table_name(password,email,secret_key,client_id,timezone) 
		values('%s','%s','%s','%d','%s')","$CB_Client_Password","$CB_email","$CB_Client_Secret","$CB_Client_ID","$CB_Client_TimeZone"
    )
);
}
}

You aren’t using an array.

https://developer.wordpress.org/reference/classes/wpdb/prepare/

i dont know how to use it using with array, the link you show is too complex to me. Do you have a simple method?

Yes, the simple method is to read what I posted on how to use it. The link gives examples too. If that is outside of your understanding, then you didn’t write this to begin with and should contact the person that did.

Sponsor our Newsletter | Privacy Policy | Terms of Service