ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:concat

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
v5:reference:concat [2016/01/16 23:26] mnewnhamv5:reference:connection:concat [2016/01/29 21:34] (current) mnewnham
Line 7: Line 7:
 </WRAP> </WRAP>
 ===== Description ===== ===== Description =====
-The function ''concat()'' takes an input CSV list strings, and returns a database-specific string of concatenated values+The function ''concat()'' takes an variable list of strings, and returns a database-specific string of concatenated values. It is important to recognize the difference between concatenating a database field or a string when using the method in an SQL statement
 ------------------------------- -------------------------------
 ===== Usage ===== ===== Usage =====
Line 14: Line 14:
  * Assume MySQL database  * Assume MySQL database
  */  */
-$list = 'VOGON,POETRY,READING'; +$string = $db->concat('VOGON','POETRY','READING');
- +
-$string = $db->concat($list);+
  
 /* /*
- * Returns: CONCAT(VOGON,POETRY,READING);+ * Returns: CONCAT(VOGON,POETRY,READING) 
 + * assuming that they are database columns
 */ */
 </code> </code>
v5/reference/connection/concat.1452983169.txt.gz · Last modified: 2017/04/21 11:36 (external edit)