[thelist] [sql] append function?

Rob Whitener rwhitener at DesignOptions.com
Tue Jan 7 18:17:01 CST 2003


That's a toughie.  I was looking over the MySQL manual online and came
across this page:

http://www.mysql.com/doc/en/ANSI_mode.html

Apparently if you start mysqld with ansi || becomes a concatenation
operator.

CONCAT() is also a function in MySQL

http://www.mysql.com/doc/en/String_functions.html#IDX1164

-----Original Message-----
From: Paul Bennett [mailto:paul at teltest.com]
Sent: Tuesday, January 07, 2003 7:02 PM
To: thelist at lists.evolt.org
Subject: Re: [thelist] [sql] append function?


you mean like this (sql statement)

$sql = "update $jobsTable set partsUsed = partsUsed.'$newData' where
reference = '$id' limit 1";
?

this throws an error in mysql (syntax error)
If you meant for me to do that in php, that is what I am already doing.
What I am looking for is an SQL staement to avoid 2 database calls to
append the data.

Rob Whitener wrote:

>If you are trying to concatenate $newData to the end of field, use the "."
>operator (like perl) to perform the concatenation.
>
>-----Original Message-----
>From: Paul Bennett [mailto:paul at teltest.com]
>Sent: Tuesday, January 07, 2003 6:28 PM
>To: thelist at lists.evolt.org
>Subject: [thelist] [sql] append function?
>
>
>Currently to append new data into a field I have to make 2 queries. One
>(select) to get the existing data, php to append the new data to the end
>of the old, and then another query (update) to put the new data in. I am
>using text data and found that using:
>
>$sql = "update $tableName set field = field + $newData where....";
>
>doesn't work as I suspect it expects two numeric operators to perform
>addition.
>Is there anything like:
>$sql = "update $tableName set field = APPEND($newData) where....";
>I have googled,  searched a few favourite php haunts, and even the mysql
>manual with no joy as yet...
>
>--
>Paul Bennett
>Internet Developer
>Teltest Electronic Design
>--------------------------
>Phone : 64 4 237 0767
>Web : http://www.teltest.com
>Wap : http://wap.teltest.com
>Email : paul at teltest.com
>--------------------------
>
>
>--
>* * Please support the community that supports you.  * *
>http://evolt.org/help_support_evolt/
>
>For unsubscribe and other options, including the Tip Harvester
>and archives of thelist go to: http://lists.evolt.org
>Workers of the Web, evolt !
>
>

--
Paul Bennett
Internet Developer
Teltest Electronic Design
--------------------------
Phone : 64 4 237 0767
Web : http://www.teltest.com
Wap : http://wap.teltest.com
Email : paul at teltest.com
--------------------------



--
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !



More information about the thelist mailing list