Title: Insert row in external database
Last modified: August 22, 2016

---

# Insert row in external database

 *  [Opariti](https://wordpress.org/support/users/opariti/)
 * (@opariti)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/insert-row-in-external-database/)
 * I want to insert data into the table ‘cls_users’ of an external Mysql database.
   
   I started with this:
 *     ```
       try {
       		$cmsadb = new wpdb(CMSA_USERNAME, CMSA_PASSWORD, CMSA_DATABASE, CMSA_HOSTNAME);
       		$cmsadb->show_errors();
       	} catch (Exception $e)	{
       		writeLogWP("Connection error: " . $e->getMessage());
       	}
       ```
   
 * with no error; then I tryed to insert into table ‘cls_users’:
 *     ```
       $name = 'john';
       $email = 'john@example.com';
       $result = $cmsadb->insert('cls_users',
       			array(
       				'name' => $name,'mail' => $email));
       ```
   
 * But got $result = false.
    What am I do wrong? Thanks

Viewing 1 replies (of 1 total)

 *  Thread Starter [Opariti](https://wordpress.org/support/users/opariti/)
 * (@opariti)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/insert-row-in-external-database/#post-5605587)
 * I did it though classical mysql/php …

Viewing 1 replies (of 1 total)

The topic ‘Insert row in external database’ is closed to new replies.

## Tags

 * [external database](https://wordpress.org/support/topic-tag/external-database/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [Opariti](https://wordpress.org/support/users/opariti/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/insert-row-in-external-database/#post-5605587)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
