entry that allready exists

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
sarris
Forum Contributor
Posts: 137
Joined: Mon Dec 04, 2006 2:44 pm

entry that allready exists

Post by sarris »

hi there...
if i try to INSERT a record to a table that allready exists (according to primary key) i guess the procedure stops.
I am calling my sql querries with PHP...is there a way to be informed that "the record you tried to insert allready exists" ??

thanks in advnace
User avatar
CoderGoblin
DevNet Resident
Posts: 1425
Joined: Tue Mar 16, 2004 10:03 am
Location: Aachen, Germany

Post by CoderGoblin »

mysql_affected_rows can be used to check if the row is inserted. If not you have some form of error. You should be able to get this error with mysql_error or mysql_errno.
Post Reply