php - How To Construct This Query To Replace A Row With A Matching Element -
so, objective here send user id current date of login server. here's image of results.

now here code i'm using:
$command = "insert ignore `userstats`(`userid`, `lastlogin`) values($userid, curdate())"; mysqli_query($con,$command); i want command automatically update last login date of row same userid. how can go doing this? i'm new mysql.
if not mistaken want, possibly yo need replace or update
replace `userstats`(`userid`, `lastlogin`) values($userid, curdate()); by query, userid not double exist if prim key or unique;
or simpy this:
update `userstats` set `lastlogin` = curdate() `userid` = $userid; good luck !!
Comments
Post a Comment