v5:reference:connection:ifnull
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
reference:ifnull [2015/07/20 03:37] – [Description] mnewnham | v5:reference:connection:ifnull [2016/01/16 23:34] (current) – ↷ Page moved from v5:reference:ifnull to v5:reference:connection:ifnull mnewnham | ||
---|---|---|---|
Line 8: | Line 8: | ||
</ | </ | ||
===== Description ==== | ===== Description ==== | ||
- | The function '' | + | The function '' |
- The field in the table to check. | - The field in the table to check. | ||
Line 15: | Line 15: | ||
===== Usage ===== | ===== Usage ===== | ||
<code php> | <code php> | ||
+ | /* | ||
+ | * Assume mysql database connection | ||
+ | */ | ||
+ | $ifNullString = $db-> | ||
+ | |||
+ | /* | ||
+ | * ifnullString returns 'CASE WHEN pants_field is null | ||
+ | THEN ' | ||
+ | ELSE pants_field | ||
+ | END "; | ||
+ | */ | ||
+ | |||
+ | $SQL = " | ||
+ | SET pants_field = $ifNullString"; | ||
+ | |||
+ | $db-> | ||
</ | </ |
v5/reference/connection/ifnull.1437356236.txt.gz · Last modified: 2017/04/21 11:34 (external edit)