phpbar.de logo

Mailinglisten-Archive

Re: Replace
Archiv Mailingliste mysql-de

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

Re: Replace



Hi,

Marcus Fihlon <m.fihlon_(at)_mobilcom.de> schrieb mir:

> > Diese Query �ndert leider nichts:
> 
> > "replace into ltcd (appid, appname, appurl, appokay) values ('$appid',
> > '$appname2', '$appurl2', '$appokay2') where appid = '$appid'"
> 
> So sollte es funktionieren:
> 
>     update ltcd
>         set appid   = '$addid',
>             appname = '$appname2',
>             appurl  = '$appurl2',
>             appokay = '$appokay2'
>             where appid = '$appid'
>     ;

So:

| REPLACE INTO ltcd 
| (appid, appname, appurl, appokay) 
| VALUES ('$appid', '$appname2', '$appurl2', '$appokay2');

sollte es eigentlich auch tun, da appid der primary Key der 
Tabelle ist. Gibt es diesen Wert schon, wird der Datensatz
ge�ndert, gibt es ihn nicht, wird ein neuer Datensatz ange-
legt. Aber vorsicht: bei einem "REPLACE INTO" werden immer
nur die �bergebenen Daten eingepflegt; der Rest wird auf den
Default-Wert gesetzt.

Gru�,

	Thomas
-- 
"Enough for the left, enough for the right
 Enough for the black, enough for the white
 All of us equal and all of us stand in the light"

---
*** Abmelden von dieser Mailingliste funktioniert per E-Mail
*** an mysql-de-request_(at)_lists.4t2.com mit Betreff/Subject: unsubscribe


Home | Main Index | Thread Index

php::bar PHP Wiki   -   Listenarchive