Title: Plugin-dev: inserting data in custom table
Last modified: August 18, 2016

---

# Plugin-dev: inserting data in custom table

 *  [nutsmuggler](https://wordpress.org/support/users/nutsmuggler/)
 * (@nutsmuggler)
 * [20 years, 7 months ago](https://wordpress.org/support/topic/plugin-dev-inserting-data-in-custom-table/)
 * I am writing a plugin that, when activated, generates a table called wp-events.
   The events are inserted through a subpanel in the manage menu, with a <form method
   =”post”>.
    Now,I don’t know how and where (in my code) to query the table that
   I have created. I tried to hook in to the wp-head, calling this function:
 * // main function, updating the events table
    function dbes_action_wp_head() {
   global $table_prefix, $wpdb; if(isset($_POST[‘events_update’])) { $table_name
   = $table_prefix.TBNAME; $event_name =$_REQUEST[‘event_name’]); $wpdb->query(“
   INSERT INTO $table_name (name) VALUES ($event_name)”); }
 * }
 * TBNAME is a constant I am using for my custom table.
 * This code generates an error:
    Parse error: parse error, unexpected ‘)’ in the
   line $event_name =$_REQUEST[‘event_name’]);
 * I cannot locate my mistake..
    Any help will be appreciated. Cheers, Davide

The topic ‘Plugin-dev: inserting data in custom table’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [nutsmuggler](https://wordpress.org/support/users/nutsmuggler/)
 * Last activity: [20 years, 7 months ago](https://wordpress.org/support/topic/plugin-dev-inserting-data-in-custom-table/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
