public static function get($idvisitor) { $row = Db::fetchRow("SELECT * FROM " . Common::prefixTable('chat_personnal_informations') . " WHERE idvisitor = ?", array(@Common::hex2bin($idvisitor))); if (!$row) { $row = array('name' => NULL, 'email' => NULL, 'phone' => NULL, 'comments' => NULL); } else { $row = ChatCommon::formatRow($row); } return $row; }
public function getVisitorLastMessage() { $arguments = array($this->idsite, @Common::hex2bin($this->idvisitor)); $row = Db::fetchRow("SELECT idvisitor, answerfrom, content, microtime,\n\t\t(SELECT name FROM " . Common::prefixTable('chat_personnal_informations') . " WHERE idvisitor = chat.idvisitor) AS name\n\t\tFROM " . Common::prefixTable('chat') . " AS chat WHERE idsite = ? AND idvisitor = ? ORDER BY microtime DESC LIMIT 1", $arguments); $row = ChatCommon::formatRow($row); return $row; }