Ejemplo n.º 1
0
 /**
  * 
  * Enter description here ...
  * @param Range $r
  */
 public static function save(Range $r)
 {
     $dbh = $GLOBALS['dbh'];
     if ($r->get_id()) {
         // Update
         $data = $dbh->prepare("\n\t\t\t\tUPDATE \n\t\t\t\t\t`range`\n\t\t\t\tSET \n\t\t\t\t\tname=:name\n\t\t\t\tWHERE \n\t\t\t\t\tid=:id\n\t\t\t");
         $data->execute(array(':name' => $r->get_name(), ':id' => $r->get_id()));
     } else {
         // Insert
         $data = $dbh->prepare("\n\t\t\t\tINSERT \n\t\t\t\t\tINTO `range` (name)\n\t\t\t\tVALUES\n\t\t\t\t\t(:name)\n\t\t\t");
         $data->execute(array(':name' => $r->get_name()));
     }
 }