How to change the database error prompt to js?
Use if (insert statement) {echo "<script>alert('This data already exists')</script>"}
insert If the statement encounters a duplicate unique key, it will not return false but directly display a database error
ringa_lee2017-05-16 13:08:49
try catch I usually set a unique primary key and check to see if there are duplicates before inserting