php - MySQL Script not entering correctly -


i have mysql , php script enter row when doesn't exist.

insert `tblplayerachievements` (hs_id, achievementid, achievementprogress)  select * (select ".$userdata['hs_id'].", ".$achievementid.", 0) tmp  not exists (select * `tblplayerachievements`  hs_id=".$userdata['hs_id']." , achievementid=".$achievementid.")  limit 1 

this works until both $userdata['hs_id'] , $achievementid same value , skips one. how fix this?

since haven't bothered answering question happens if row exists, i'm going assume want insert fail. in case, need create unique index on (hs_id, achievementid). recommend set default value of 0 on achievementprogress query needs specify ids create row.


Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -