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.

stuff

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

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -