ADOdb

Database Abstraction Layer for PHP

User Tools

Site Tools


v5:reference:connection:ifnull

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
reference:ifnull [2015/07/20 13:53] – [Usage] mnewnhamv5: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:
 </WRAP> </WRAP>
 ===== Description ==== ===== Description ====
-The function ''ifNull()'' returns a database-specific string providing the means to replace a null value with a specified replacement. The two parameters are:+The function ''ifNull()'' returns a database-specific string providing the means to replace a null value with a specified replacement. If the value in the database is not null, the value is not updated. The two parameters are:
  
   - The field in the table to check.   - The field in the table to check.
Line 21: Line 21:
  
 /* /*
- * ifnullString returns 'CASE WHEN pants_field is null THEN 'chinos' ELSE pants_field END ";+ * ifnullString returns 'CASE WHEN pants_field is null  
 +                              THEN 'chinos'  
 +                              ELSE pants_field  
 +                              END ";
 */ */
  
-$SQL = "UPDATE attire SET pants_field = $ifNullString";+$SQL = "UPDATE attire  
 +           SET pants_field = $ifNullString";
  
 $db->Execute($SQL); $db->Execute($SQL);
 </code> </code>
v5/reference/connection/ifnull.1437393229.txt.gz · Last modified: 2017/04/21 11:34 (external edit)