Guest User

Untitled

a guest
Dec 13th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. CREATE TABLE `user_settings` (
  2. `userid` int(11) unsigned NOT NULL,
  3. `name` varchar(50) NOT NULL,
  4. `type` BOOL NOT NULL,
  5. `value_int` int(10) DEFAULT NULL,
  6. `value_str` varchar(100) DEFAULT NULL,
  7. PRIMARY KEY (`userid`, `name`)
  8. );
  9.  
  10. #`userid`: The user that this setting applies to
  11. #`name`: The name of the setting
  12. #`type`: Tells you the set value is stored in `value_int` or `value_str`, (1 or 0, respectively)
  13. #`value_int`: Contains the value of the setting if type is 1
  14. #`value_str`: Contains the value of the setting if type is 0
  15.  
  16. #Example of inserting settings
  17. #INSERT INTO user_settings (user_id, name, type, value_int) VALUES (1, 'fontsize', 1, 18) ON DUPLICATE KEY UPDATE value_int=65;
  18. #INSERT INTO user_settings (user_id, name, type, value_str) VALUES (1, 'fontcolor', 0, 'red') ON DUPLICATE KEY UPDATE value_str='red';
Add Comment
Please, Sign In to add comment