title: Mysql primary key when using INSERT INTO ... ON DUPLICATE KEY UPDATE
body: <p>My table structure is:</p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `users_settings_temp` (
    `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
    `userid` int(10) unsigned DEFAULT NULL,
    `type` enum('type1','type2')
    `data` text,
    `date_created` int(11) DEFAULT NULL,
    PRIMARY KEY (`id`)
  ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
  </code></pre>
  
  <p>What I am trying to do is:</p>
  
  <p>Let say I want to insert a new entry, but I dont want it to be duplicate, after google around, i found this format:</p>
  
  <pre><code>INSERT INTO users_settings_temp(...)
  ON DUPLICATE KEY UPDATE data = '{$data}'
  </code></pre>
  
  <p>I guess the problem is in my table, the primary key => <code>id</code>. How do I alter the table, so that I could use the: </p>
  
  <pre><code>INSERT INTO ... ON DUPLICATE KEY UPDATE
  </code></pre>
  
  <p>Can I use user_id + type as primary key? If yes, could you please show me how to do it?</p>