phpbar.de logo

Mailinglisten-Archive

[php] Update in MySQL DB

[php] Update in MySQL DB

Axel Tietje a.tietje_(at)_flynet.de
Thu, 16 Dec 1999 16:24:22 +0100


> Und jetzt das schönste......
> Es hat fusioniert. Aber warum bitte schön nicht mit replace???

mySQL Manual spricht zu uns:

7.15 REPLACE syntax
     REPLACE [LOW_PRIORITY | DELAYED]
        [INTO] tbl_name [(col_name,...)]
        VALUES (expression,...)
  or REPLACE [LOW_PRIORITY | DELAYED]
        [INTO] tbl_name [(col_name,...)]
        SELECT ...
  or REPLACE [LOW_PRIORITY | DELAYED]
        [INTO] tbl_name
        SET col_name=expression, col_name=expression,...

REPLACE works exactly like INSERT, except that if an old record
in the table has the same value as a new record on a unique index,
the old record is deleted before the new record is inserted.
See section 7.14 INSERT syntax.

Frage: Ist Deine Spalte id ein unique index?

Grusz, Axel.




php::bar PHP Wiki   -   Listenarchive