You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(id=5,uid=14, address=xxx) changed to (id=5,uid=14, address=yyyy )
field uid with unique index
CREATE TABLE contact (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
uid int(255) NOT NULL,
address varchar(255) COLLATE utf8_unicode_ci DEFAULT ,
UNIQUE KEY uid (uid)
field uid without unique index
CREATE TABLE
contact
(id
int(10) unsigned NOT NULL AUTO_INCREMENT,uid
int(255) NOT NULL,address
varchar(255) COLLATE utf8_unicode_ci DEFAULT '')ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
nothing happened
add new row with (id=5,uid=14, address=xxx)
repeat
add new row with (id=6,uid=14, address=xxx)
(id=5,uid=14, address=xxx) changed to (id=5,uid=14, address=yyyy )
field uid with unique index
CREATE TABLE contact (
id int(10) unsigned NOT NULL AUTO_INCREMENT,
uid int(255) NOT NULL,
address varchar(255) COLLATE utf8_unicode_ci DEFAULT ,
UNIQUE KEY
uid
(uid
))
ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
nothing happened
add new row (id=7,uid=24,address=aaaa)
repeat
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '24' for key 'uid'' in
(id=7,uid=14, address=aaaa) changed to (id=7,uid=24, address=bbbb )
conclusion:
if first param $data include uid then insert new record
first param $data exclude uid then update record
not automatic as expect
The text was updated successfully, but these errors were encountered: