PDA

View Full Version : Update Text Field


VBDev
04-08-2004, 07:08 PM
Hurm, how to update a field of text to add sthg at then end ?
With a INT field, no problem, an update query with field = field + X works perfectly but I want to do this :


$DB_site->query("UPDATE ". TABLE_PREFIX ."password SET users=users & '$bbuserinfo[userid]' WHERE postid='$postid'");

This doesn't work
I've tried with + instead of the &, same result, it doesn't work correctly

By searchin on mysql.com (thanks Dean :lick: ), I found this function concat_ws but I don't know the exact structure and it doesn't work fine with this :

$DB_site->query("UPDATE ". TABLE_PREFIX ."password SET users=concat_ws(users,'$bbuserinfo[userid],') WHERE postid='$postid'");


It only replace my field with the new userid

How can I do this with only one query ?!

Thanks by advance

VBDev
04-09-2004, 05:23 AM
Nobody knows ?! :-/

VBDev
04-09-2004, 08:01 AM
I've found :)

I just had to use a concat()

$DB_site->query("UPDATE ". TABLE_PREFIX ."password SET users=concat(users,'$bbuserinfo[userid],') WHERE postid='$postid'");

Dean C
04-09-2004, 12:01 PM
Hehe there you go :)!