Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- CREATE TABLE $rounds_table (
- ID BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
- state ENUM('OPEN', 'CLOSED', 'PUBLISHED', 'COMPLETE') DEFAULT 'OPEN',
- title TEXT NOT NULL,
- created DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL,
- PRIMARY KEY(ID)
- );
- function create_round($name) {
- global $wpdb;
- $rounds_table = $wpdb->prefix . "videovote_rounds";
- $result = $wpdb->insert($rounds_table, array( 'title' => $name, 'state' => 'OPEN', 'created' => 'Now()'));
- return $wpdb->insert_id;
- }
- create_round("test");
- result:
- mysql> select * from wp_videovote_rounds;
- +----+-------+-------+---------------------+
- | ID | state | title | created |
- +----+-------+-------+---------------------+
- | 1 | OPEN | | 0000-00-00 00:00:00 |
- | 2 | OPEN | | 0000-00-00 00:00:00 |
- +----+-------+-------+---------------------+
- 2 rows in set (0.00 sec)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement