handling duplicate records in mysql Insert statement

前端 未结 4 1935
被撕碎了的回忆
被撕碎了的回忆 2021-01-26 10:59

Im i have a php form to enter data into a mysql database, my question is how do i handle duplicate records for example if an ID number already exsists how do i check if exsists

4条回答
  •  既然无缘
    2021-01-26 11:42

    do a select like : select count(loan_id) from load where load_id=$values[loan_id] than if result>0 don't insert and give error message "ID is already in the database" to user, otherwise insert it.

提交回复
热议问题