Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INSERT INTO table (color, size) VALUES ('blue', '18') ...
- CREATE TABLE `firm_pref` (
- `id` int(9) NOT NULL AUTO_INCREMENT,
- `firm_id` int(9) NOT NULL, //user_id in this case
- `header_title` varchar(99) NOT NULL,
- `statement` varchar(99) NOT NULL,
- `footer_content` varchar(99) NOT NULL,
- PRIMARY KEY (`id`)
- ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
- INSERT INTO table (user_id, color, size) VALUES (NULL, 'blue', 18);
- CREATE TABLE `prefs` (
- `id` int(9) NOT NULL AUTO_INCREMENT,
- `firm_id` int(9) NOT NULL,
- ...
- PRIMARY KEY (`id`),
- UNIQUE KEY (`firm_id`)
- );
- INSERT INTO prefs(firm_id, header_title, statement, footer_content)
- VALUES(17, 'blue', '18', 'some_footer')
- ON DUPLICATE KEY UPDATE
- header_title = 'blue',
- statement = '18',
- footer_content = 'some_footer';
- id | name
- =========
- 1 | color
- 2 | size
- id | name
- ================
- 1 | Martin Bean
- option_id | user_id | value
- ===========================
- 1 | 1 | Blue
- 2 | 1 | Large
- DELETE FROM `options_users`
- WHERE `user_id` = @user_id;
- INSERT INTO `options_users` (`option_id`, `user_id`, `value`)
- VALUES (1, @user_id, 'Blue'), (2, @user_id, 'Large');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement