If you want to enter a new records that is not exits then you can use Mysql two methods
Method 1 'REPLACE' :-
REPLACE INTO `users`
SET `userid` = 65,
`username` = 'abc',
`useremail` = 'abc@gmail.com';
In this case if record exists, the query will overwrite the entry with values but if it does not exist with userid, it will enter a new entry.
Method 2 ' INSERT IGNORE' :-
INSERT IGNORE INTO `users`
SET `userid` = 65,
`username` = 'abc',
`useremail` = 'abc@gmail.com';
Now in the case above if the userid exits with 65 then query will skip this entry and continue proceed.
Benefit of using this query is it not modify you entry.
0 Comment(s)