Title: wpdb insert issue &#8211; Not inserting correct value
Last modified: August 19, 2016

---

# wpdb insert issue – Not inserting correct value

 *  Resolved [DigitalSquid](https://wordpress.org/support/users/twelvefootsnowman/)
 * (@twelvefootsnowman)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/wpdb-insert-issue-not-inserting-correct-value/)
 * I’ve was trying to add a simple little form on my site to do a bit of data capture.
   Nothing too complicated – just getting visitors first name, last name and email
   address and then saving it to a table in my DB.
 * Here’s the line of code I’m using to do the insert.
 * `$wpdb->insert('signup', array(fname => $_POST['fname'], lname => $_POST['lname'],
   email => $_POST['email']), array( '%s', '%d'))`
 * When I check the results in the DB, the fname and email fields work perfectly–
   they get the correct values from the form. However, the lname field always ends
   with a value of 0.
 * What baffles me is that if I output the $_POST variables before and after the
   insert, they are all correct. All of them show the values that were submitted
   from the form.
 * I’ve checked the structure of the DB fields as well, all 3 are Varchar(50), latin1_general_ci
   and I don’t think lname is a reserved word or anything.
 * Any ideas why the $_POST[‘lname’] variable always seems to end up being inserted
   as 0?

The topic ‘wpdb insert issue – Not inserting correct value’ is closed to new replies.

## Tags

 * [incorrect](https://wordpress.org/support/topic-tag/incorrect/)
 * [value](https://wordpress.org/support/topic-tag/value/)
 * [wpdb](https://wordpress.org/support/topic-tag/wpdb/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [DigitalSquid](https://wordpress.org/support/users/twelvefootsnowman/)
 * Last activity: [15 years, 11 months ago](https://wordpress.org/support/topic/wpdb-insert-issue-not-inserting-correct-value/)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
