You are here: Re: Determining whether to INSERT or UPDATE « PHP Programming Language « IT news, forums, messages
Re: Determining whether to INSERT or UPDATE

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация