Version: 1.0
Type: Function
Category: Databases
License: GNU General Public License
Description: Small but handy function to emulate an Access-style DLookup function.
function DLookup($fld, $tab, $whr) { $q = "Select $fld from $tab where $whr"; $rst = mysql_query($q); if ($row = mysql_fetch_object($rst)) return $row->$fld; else return NULL; } // ex: lookup a customer name based on $customerid $name = DLookup("Name", "Customer", "Id=$customerid");