ive googled for 1½ hour and cant come to an understanding how to do this.
i want to update my current row, but keep values that are already assigned. i currently have a checkbox which either gives "1" or "0". if the checkbox returns "0" i dont want it to update it as there's no point to it updating. however i dont know how to do this.
if i get col1 as a duplicate entry, then it should update col2,3,4,5 if the entry isnt already filled by a "1" or if the variable gotten from my form is "0".
i could do this with a lot of if statements but id prefer not to. and be aware that my code is extremely messy right now because im just trying to find a solution. the code will be fixed when i get the result i want to. also the code is written in mysql because im more familiar in it and will be ported to pdo when its done. please dont tell me "dont use mysql" and dont give me an answer. already gotten those often enough
$insert_movie = "INSERT INTO filmer (namn, rel_720p, rel_1080p, rel_dvdr, swesub, addate)
VALUES ('$namn','$rel_720p','$rel_1080p','$rel_dvdr','$swesub',CURRENT_TIMESTAMP)
ON DUPLICATE KEY UPDATE
rel_720p = IF('$rel_720p' IS NOT NULL, '$rel_720p', rel_720p), rel_1080p = IF('$rel_1080p' IS NOT NULL, '$rel_1080p', rel_1080p), rel_dvdr = VALUES(rel_dvdr), swesub = VALUES(swesub)";
$result = mysql_query($insert_movie, $connection) or die (mysql_error());
mysql_close($connection);
pictures of whats happening: first entry: http://puu.sh/9iN0p/91f0839b8f.png second entry: http://puu.sh/9iN2Q/8cafdb5422.png
look at the last row in there. from the first picture to the second it should be 1,1,1,1 and not 0,1,1,0.