function Match($identifier = NULL, $PDOconn = NULL) { //Call super constructor parent::CDObject('mach', $PDOconn); //Try to identify the user if($identifier == NULL) return; //First try to search by ID $sql = "SELECT objectID FROM mach WHERE objectID=:objectID"; $stmtA = $this->PDOconn->prepare($sql); $paramsA[':objectID'] = $identifier; $stmtA->execute($paramsA); //Any users by id? if($stmtA->rowCount() > 0) { $row = $stmtA->fetch(); $this->ID = $row['objectID']; $this->exists = true; $this->refresh(); return; //Done } }
function Conversation($identifier = NULL, $PDOconn = NULL) { //Call super constructor parent::CDObject('conversation', $PDOconn); //Try to identify the user if($identifier == NULL) return; //First try to search by ID $sql = "SELECT objectID FROM conversation WHERE objectID=:objectID"; $stmtA = $this->PDOconn->prepare($sql); $paramsA[':objectID'] = $identifier; $stmtA->execute($paramsA); //Any convos by id? if($stmtA->rowCount() > 0) { $row = $stmtA->fetch(); $this->ID = $row['objectID']; $this->exists = true; $this->refresh(); return; //Done } //Try by row $sql = "SELECT objectID FROM conversation WHERE row=:row"; $stmtC = $this->PDOconn->prepare($sql); $paramsC[':row'] = $identifier; $stmtC->execute($paramsC); if($stmtC->rowCount() > 0) { $row = $stmtC->fetch(); $this->ID = $row['objectID']; $this->exists = true; $this->refresh(); return; } }