i have a mysql table with columns like this
id
userid
userName
role
id is primary key, userid is unique
so i want to insert data to mysql from phplike this
if userid(in this case 11) is not in the db
INSERT INTO tblName (userid,userName,role) VALUES ('11','name','admin')
if this userid is exist in db then update username and role
UPDATE tblName SET userName = 'name', role = 'admin' WHERE userid=11;