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
Next revisionBoth sides next revision
reference:ifnull [2015/07/20 13:53] – [Usage] mnewnhamreference:ifnull [2015/11/24 16:00] – [Description] 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.txt · Last modified: 2016/01/16 23:34 by mnewnham