{"action":"created","issue":{"url":"https://api.github.com/repos/joshcam/PHP-MySQLi-Database-Class/issues/321","labels_url":"https://api.github.com/repos/joshcam/PHP-MySQLi-Database-Class/issues/321/labels{/name}","comments_url":"https://api.github.com/repos/joshcam/PHP-MySQLi-Database-Class/issues/321/comments","events_url":"https://api.github.com/repos/joshcam/PHP-MySQLi-Database-Class/issues/321/events","html_url":"https://github.com/joshcam/PHP-MySQLi-Database-Class/issues/321","id":106012876,"number":321,"title":"onduplicate not working","user":{"login":"weha","id":5836955,"avatar_url":"https://avatars.githubusercontent.com/u/5836955?v=3","gravatar_id":"","url":"https://api.github.com/users/weha","html_url":"https://github.com/weha","followers_url":"https://api.github.com/users/weha/followers","following_url":"https://api.github.com/users/weha/following{/other_user}","gists_url":"https://api.github.com/users/weha/gists{/gist_id}","starred_url":"https://api.github.com/users/weha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weha/subscriptions","organizations_url":"https://api.github.com/users/weha/orgs","repos_url":"https://api.github.com/users/weha/repos","events_url":"https://api.github.com/users/weha/events{/privacy}","received_events_url":"https://api.github.com/users/weha/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-11T13:38:35Z","updated_at":"2015-09-22T13:47:59Z","closed_at":null,"body":"I specify an onduplicate but it does not get used in the query:\r\n\r\n`$sql['created']='NOW()';`\r\n`$sql['year'] = date('o',$moment);`\r\n`$sql['week'] = date('W',$moment);`\r\n`$sql['text'] = $dbi->escape($text);`\r\n`$dbi->onDuplicate('text');`\r\n`$sql_result = $dbi->insert('calendar_weekcomments',$sql);`\r\n\r\n$sql_result is empty/null/false\r\n\r\ngetlastquery: INSERT  INTO calendar_weekcomments (`created`, `year`, `week`, `text`)  VALUES ('NOW()', '2015', '37', 'testjedd')\r\n\r\nSo year & week are a key and a row already exists so in this scenario I can't save the new text for that week.\r\nIf there is no duplicate the query works."},"comment":{"url":"https://api.github.com/repos/joshcam/PHP-MySQLi-Database-Class/issues/comments/142294225","html_url":"https://github.com/joshcam/PHP-MySQLi-Database-Class/issues/321#issuecomment-142294225","issue_url":"https://api.github.com/repos/joshcam/PHP-MySQLi-Database-Class/issues/321","id":142294225,"user":{"login":"rajjanorkar","id":7500838,"avatar_url":"https://avatars.githubusercontent.com/u/7500838?v=3","gravatar_id":"","url":"https://api.github.com/users/rajjanorkar","html_url":"https://github.com/rajjanorkar","followers_url":"https://api.github.com/users/rajjanorkar/followers","following_url":"https://api.github.com/users/rajjanorkar/following{/other_user}","gists_url":"https://api.github.com/users/rajjanorkar/gists{/gist_id}","starred_url":"https://api.github.com/users/rajjanorkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rajjanorkar/subscriptions","organizations_url":"https://api.github.com/users/rajjanorkar/orgs","repos_url":"https://api.github.com/users/rajjanorkar/repos","events_url":"https://api.github.com/users/rajjanorkar/events{/privacy}","received_events_url":"https://api.github.com/users/rajjanorkar/received_events","type":"User","site_admin":false},"created_at":"2015-09-22T13:47:59Z","updated_at":"2015-09-22T13:47:59Z","body":"$sql['created']=$db->now();\r\n$sql['year'] = date('o',$moment);\r\n$sql['week'] = date('W',$moment);\r\n$sql['text'] = $db->escape($text);\r\n$update_col = array(\"text\");\r\n$db->onDuplicate($update_col);\r\n$db->insert('calendar_weekcomments', $sql);"}}