Created
October 23, 2019 19:40
-
-
Save MostafaNorzade/f569d019bab390242d3692d11296a1e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//--- update or insert | |
INSERT INTO MyGuests (id, lastname) VALUES (2, 'Doe') | |
ON DUPLICATE KEY UPDATE lastname = 'Doe'; | |
UPDATE MyGuests SET lastname='Doe' WHERE id=2 | |
IF ROW_COUNT()=0 | |
INSERT INTO MyGuests (lastname, id) VALUES ('Doe',2); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment