Posted by Rik Wasmus on 01/02/08 01:49
On Wed, 02 Jan 2008 02:22:19 +0100, Charles Polisher
<cpolish@nonesuch.com> wrote:
>>>> Aaron Gray wrote:
>> I have a MySQL table of pages each with a 'title' and 'page' fields.
>>
>> How do I do either an UPDATE if the pages 'title' exists or an INSERT
>> if
>> it
>> does not ?
>
> Check out the REPLACE syntax:
> http://dev.mysql.com/doc/refman/5.0/en/replace.html
>
> Your code looks okay ... what does print_r($title)
> show? Where's the BEGIN for the transaction?
>
REPLACE has drawbacks, especially with foreign constraints & triggers...
ask in comp.databases.mysql what they are.
--
Rik Wasmus
Navigation:
[Reply to this message]
|