View Single Post
Old 01-19-2013, 04:41 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,653
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
This isn't really a PHP issue.
The first approach you can do is to not flag the address as unique and allow multiple inserts. This only works if the logic of the design allows a many to many relationship. This can then accept a count.
Another approach would be to simply use an INSERT ON DUPLICATE KEY UPDATE syntax to issue an update when it finds a duplicate. The documentation for that is here: http://dev.mysql.com/doc/refman/5.0/...duplicate.html
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Users who have thanked Fou-Lu for this post:
countrydj (01-19-2013)