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 revisionBoth sides next revision
reference:ifnull [2015/07/20 03:37] – [Description] mnewnhamreference:ifnull [2015/07/20 13:53] – [Usage] mnewnham
Line 15: Line 15:
 ===== Usage ===== ===== Usage =====
 <code php> <code php>
 +/*
 + * Assume mysql database connection
 +*/
 +$ifNullString = $db->ifNull('pants_field','chinos');
 +
 +/*
 + * ifnullString returns 'CASE WHEN pants_field is null THEN 'chinos' ELSE pants_field END ";
 +*/
 +
 +$SQL = "UPDATE attire SET pants_field = $ifNullString";
 +
 +$db->Execute($SQL);
 </code> </code>
v5/reference/connection/ifnull.txt · Last modified: 2016/01/16 23:34 by mnewnham