v5:reference:connection:concat
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
v5:reference:concat [2016/01/16 23:08] – [Concat] mnewnham | v5:reference:connection:concat [2016/01/29 21:34] (current) – mnewnham | ||
---|---|---|---|
Line 7: | Line 7: | ||
</ | </ | ||
===== Description ===== | ===== Description ===== | ||
- | The function '' | + | The function '' |
+ | ------------------------------- | ||
===== Usage ===== | ===== Usage ===== | ||
<code php> | <code php> | ||
Line 13: | Line 14: | ||
* Assume MySQL database | * Assume MySQL database | ||
*/ | */ | ||
- | $list = ' | + | $string |
- | $string = $db-> | + | /* |
+ | * Returns: CONCAT(VOGON, | ||
+ | * assuming that they are database columns | ||
+ | */ | ||
+ | </ | ||
+ | ===== Concatenating Strings And Database Fields ===== | ||
+ | In order to concatenate database fields and strings together it is necessary to quote the strings | ||
+ | <code php> | ||
/* | /* | ||
- | * Returns: CONCAT(VOGON,POETRY,READING); | + | * Best methodology |
+ | */ | ||
+ | $s = $db-> | ||
+ | |||
+ | $SQL = " | ||
+ | SET last_name = {$db-> | ||
+ | WHERE first_name=' | ||
+ | AND last_name=' | ||
+ | |||
+ | $db-> | ||
+ | |||
+ | $SQL = " | ||
+ | WHERE first_name=' | ||
+ | |||
+ | print $db-> | ||
+ | |||
+ | /* | ||
+ | * Prints "Dent, Arthur Dent" | ||
*/ | */ | ||
</ | </ | ||
+ |
v5/reference/connection/concat.txt · Last modified: 2016/01/29 21:34 by mnewnham