Example #1
0
 public function addRecord()
 {
     // Verify the fields
     if ($this->_verifyInput()) {
         // Get the Database connection
         $connection = Database::getConnection();
         // Prepare the data
         $query = "INSERT INTO contacts(first_name, last_name, position, email, phone) \n      VALUES ('" . Database::prep($this->first_name) . "',\n       '" . Database::prep($this->last_name) . "',\n       '" . Database::prep($this->position) . "',\n       '" . Database::prep($this->email) . "',\n       '" . Database::prep($this->phone) . "')";
         // Run the MySQL statement
         if ($connection->query($query)) {
             $return = array('', 'Contact Record successfully added.', '');
             // add success message
             return $return;
         } else {
             // send fail message and return to contactmaint
             $return = array('contactmaint', 'No Contact Record Added. Unable to create record.', '');
             return $return;
         }
     } else {
         // send fail message and return to contactmaint
         $return = array('contactmaint', 'No Contact Record Added. Missing required information.', '0');
         return $return;
     }
 }
Example #2
0
File: lot.php Project: piiskop/pstk
 public function addRecord()
 {
     // Verify the fields
     if ($this->_verifyInput()) {
         // Get the Database connection
         $connection = Database::getConnection();
         // Prepare the data
         $query = "INSERT INTO lots(lot_name, lot_description, lot_image, lot_number, lot_price, cat_id) \n        VALUES ('" . Database::prep($this->lot_name) . "',\n         '" . Database::prep($this->lot_description) . "',\n         '" . Database::prep($this->lot_image) . "',\n         '" . (int) $this->lot_number . "',\n         '" . (double) $this->lot_price . "',\n         '" . (int) $this->cat_id . "'\n       )";
         // Run the MySQL statement
         if ($connection->query($query)) {
             $return = array('', 'Lot Record successfully added.', '');
             // add success message
             return $return;
         } else {
             // send fail message and return to categorymaint
             $return = array('lotmaint', 'No Lot Record Added. Unable to create record.', '');
             return $return;
         }
     } else {
         // send fail message and return to categorymaint
         $return = array('lotmaint', 'No Lot Record Added. Missing required information.', '0');
         return $return;
     }
 }
Example #3
0
 public function addRecord()
 {
     // Verify the fields
     if ($this->_verifyInput()) {
         // Get the Database connection
         $connection = Database::getConnection();
         // Prepare the data
         $query = "INSERT INTO categories(cat_name, cat_description, cat_image) \n        VALUES ('" . Database::prep($this->cat_name) . "',\n         '" . Database::prep($this->cat_description) . "',\n         '" . Database::prep($this->cat_image) . "')";
         // Run the MySQL statement
         if ($connection->query($query)) {
             $return = array('', 'Category Record successfully added.');
             // add success message
             return $return;
         } else {
             // send fail message and return to categorymaint
             $return = array('contactmaint', 'No Category Record Added. Unable to create record.');
             return $return;
         }
     } else {
         // send fail message and return to categorymaint
         $return = array('categorymaint', 'No Category Record Added. Missing required information.');
         return $return;
     }
 }
 /**
  * Fonction qui prepare une requete
  *
  * Exemple:
  * $sql = "SELECT * FROM user";
  * $result = Database::_query($sql);
  *
  * @author Curtis Pelissier <*****@*****.**>
  *
  * @param string $sql la requete SQL
  * @return mixed
  */
 public static function _prepare($sql = "")
 {
     self::$prep = self::$db->prepare($sql);
     return self::$prep;
 }