Title: MySQL if exist update else insert
Last modified: August 21, 2016

---

# MySQL if exist update else insert

 *  [brprasanth16](https://wordpress.org/support/users/brprasanth16/)
 * (@brprasanth16)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/mysql-if-exist-update-else-insert/)
 * I created mysql table with three columns[empid(primary key), empname, empsalary]
   using wordpress code. I want to insert a new row based on empid into table if
   it is not exist, if it is exist i want to update that the value of empsalary.
   How to write wordpress code for mysql if exist update else insert?

The topic ‘MySQL if exist update else insert’ is closed to new replies.

## Tags

 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [brprasanth16](https://wordpress.org/support/users/brprasanth16/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/mysql-if-exist-update-else-insert/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
