Re: Compare and inserting with php
| From: | Tom Worster | Date: | Tue, 30 Jun 2009 18:31:30 +0000 |
| Subject: | Re: Compare and inserting with php | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-294757@lists.php.net to get a copy of this message | ||
On 6/30/09 11:17 AM, "Ashley Sheridan" <ash@ashleysheridan.co.uk> wrote:
> It's a bad way of doing it, but could you not create a unique index on the
> particular key you want to be unique, and then just try the select anyway
> with the mysql_query() call preceeded with an @ to suppress warnings?
if you're going that route and your DB supports it, use INSERT IGNORE.
if the primary/unique key makes sense for the application then i don't think
this is all that bad a way of doing things.