Database Insert/Update/Delete

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,

This is a bit of an odd one, and while it's largely an SQL problem, it
will have PHP logic because SQL just doesn't have quite the syntax.

I'm sure this is a standard problem that has a standard solution, but as
of yet, I've not come across said solution.

I need to update a series of data in a DB. Some of it may exist already,
and some may need to be removed.

Now the typical for updating (but not removing) data and adding new is
the familiar:

INSERT ... ON DUPLICATE KEY UPDATE ...

syntax, but what about those bits which might need removing?

What's the typical solution that any of you use? I normally just empty
all rows of data sharing the common id for the set of data and then
insert new rows, but that seems wasteful to me, and less clean than it
ought to be.

Thanks,
Ash

http://www.ashleysheridan.co.uk




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux