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

**URL:** <https://www.phphelp.com/t/im-having-problem-to-use-this-code-for-wordpress-to-insert-data-to-the-database/29556>\
**Category:** General PHP Help\
**Created:** [July 23, 2019, 2:35pm UTC](https://www.phphelp.com/t/im-having-problem-to-use-this-code-for-wordpress-to-insert-data-to-the-database/29556 "2019-07-23T14:35:16Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rastafarai](https://www.phphelp.com/letter_avatar_proxy/v4/letter/r/dbc845/32.png) [@rastafarai](https://www.phphelp.com/u/rastafarai)\
**Post date:** [July 23, 2019, 2:35pm UTC](https://www.phphelp.com/t/im-having-problem-to-use-this-code-for-wordpress-to-insert-data-to-the-database/29556/1 "2019-07-23T14:35:16Z")

</div>

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.

```auto
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"
    )
);
}
}

```

---

<div class="post-metadata">

**Author:** ![astonecipher](https://www.phphelp.com/user_avatar/www.phphelp.com/astonecipher/32/2797_2.png) [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Post date:** [July 23, 2019, 2:55pm UTC](https://www.phphelp.com/t/im-having-problem-to-use-this-code-for-wordpress-to-insert-data-to-the-database/29556/2 "2019-07-23T14:55:07Z")

</div>

You aren’t using an array.

[https://developer.wordpress.org/reference/classes/wpdb/prepare/](https://developer.wordpress.org/reference/classes/wpdb/prepare/)

---

<div class="post-metadata">

**Author:** ![rastafarai](https://www.phphelp.com/letter_avatar_proxy/v4/letter/r/dbc845/32.png) [@rastafarai](https://www.phphelp.com/u/rastafarai)\
**Post date:** [July 23, 2019, 3:18pm UTC](https://www.phphelp.com/t/im-having-problem-to-use-this-code-for-wordpress-to-insert-data-to-the-database/29556/3 "2019-07-23T15:18:41Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![astonecipher](https://www.phphelp.com/user_avatar/www.phphelp.com/astonecipher/32/2797_2.png) [@astonecipher](https://www.phphelp.com/u/astonecipher)\
**Post date:** [July 23, 2019, 3:31pm UTC](https://www.phphelp.com/t/im-having-problem-to-use-this-code-for-wordpress-to-insert-data-to-the-database/29556/4 "2019-07-23T15:31:39Z")

</div>

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.
