The column called ‘ref’ will need to be unique. If it has a dupe, then it will complete the second part of the statement.
1 2 3 4 5 6 7 8 9 10 11 12 |
$results = $mysqli->query("INSERT INTO client_login (fname, sname, ref) VALUES ('Mike', 'Belmond','T99') ON DUPLICATE KEY UPDATE fname='Mike', sname='Belmond',ref='T100'"); if($results){ print 'Success! record updated / deleted'; }else{ print 'Error : ('. $mysqli->errno .') '. $mysqli->error; } |