[thelist] [mysql] concat problem

Jay Blanchard jay.blanchard at niicommunications.com
Wed Mar 30 08:17:06 CST 2005


[snip]
UPDATE mytable SET mycell = CONCAT(mycell, $FormResults) WHERE id=1

which works fine, on the provision that mycell != null

if mycell is null, then it doesn't work (returns 0 affected rows)

anyone know how i can change this to work?
[/snip]

Use an IF (not tested, so syntax may be off)

update mytable set mycell = if(mycell IS NULL, concat(mycell,
$formresults), $formresults) where id=1


More information about the thelist mailing list