public function createAction() { $entity = new WebSiteMessage(); $entity->load_from_array($this->request->getParam("web_site_message")); if (save_web_site_message($entity)) { $this->flash->setSuccess("Message sent! Thanks for getting in touch!"); $this->redirect_to(home_root_path_path()); } else { $this->flash->setError("Both fields are required, make sure you fill them! And the email must be valid one."); $this->redirect_to(home_root_path_path()); } }
/** Retrieves a list of WebSiteMessage @order = Optional, can be an array of keys or just a single key to order by the results @limit = Optional */ function list_web_site_message($order = null, $limit = null) { global $__db_conn; $sql = "SELECT * FROM web_site_message"; if ($order != null) { $order_str = $order; if (is_array($order)) { $order_str = implode(",", $order); } $sql .= " order by {$order_str}"; } if ($limit != null) { $sql .= " limit {$limit}"; } $result = mysql_query($sql, $__db_conn); $results = array(); while ($row = mysql_fetch_assoc($result)) { $tmp = new WebSiteMessage(); $tmp->load_from_array($row); $results[] = $tmp; } return $results; }