예제 #1
0
 function insert()
 {
     global $DB_LINK, $LangUI, $db_table_restaurants, $g_rb_restaurant_id_seq;
     $sql = "INSERT INTO {$db_table_restaurants} (\n\t\t\t\trestaurant_name,\n\t\t\t\trestaurant_website,\n\t\t\t\trestaurant_address,\n\t\t\t\trestaurant_city,\n\t\t\t\trestaurant_state,\n\t\t\t\trestaurant_zip,\n\t\t\t\trestaurant_country,\n\t\t\t\trestaurant_phone,\n\t\t\t\trestaurant_hours,\n\t\t\t\trestaurant_menu_text,\n\t\t\t\trestaurant_comments,\n\t\t\t\trestaurant_price,\n\t\t\t\trestaurant_delivery,\n\t\t\t\trestaurant_carry_out,\n\t\t\t\trestaurant_dine_in,\n\t\t\t\trestaurant_credit,\n\t\t\t\trestaurant_user) VALUES (\n\t\t\t\t'" . $DB_LINK->addq($this->name, get_magic_quotes_gpc()) . "',\n\t\t\t\t'" . $DB_LINK->addq($this->website, get_magic_quotes_gpc()) . "',\n\t\t\t\t'" . $DB_LINK->addq($this->address, get_magic_quotes_gpc()) . "',\n\t\t\t\t'" . $DB_LINK->addq($this->city, get_magic_quotes_gpc()) . "',\n\t\t\t\t'" . $DB_LINK->addq($this->state, get_magic_quotes_gpc()) . "',\n\t\t\t\t'" . $DB_LINK->addq($this->zip, get_magic_quotes_gpc()) . "',\n\t\t\t\t'" . $DB_LINK->addq($this->country, get_magic_quotes_gpc()) . "',\n\t\t\t\t'" . $DB_LINK->addq($this->phone, get_magic_quotes_gpc()) . "',\n\t\t\t\t'" . $DB_LINK->addq($this->hours, get_magic_quotes_gpc()) . "',\n\t\t\t\t'" . $DB_LINK->addq($this->menu_text, get_magic_quotes_gpc()) . "',\n\t\t\t\t'" . $DB_LINK->addq($this->comments, get_magic_quotes_gpc()) . "',\n\t\t\t\t" . $DB_LINK->addq($this->price, get_magic_quotes_gpc()) . ",\n\t\t\t\t'" . $DB_LINK->addq($this->delivery, get_magic_quotes_gpc()) . "',\n\t\t\t\t'" . $DB_LINK->addq($this->carry_out, get_magic_quotes_gpc()) . "',\n\t\t\t\t'" . $DB_LINK->addq($this->dine_in, get_magic_quotes_gpc()) . "',\n\t\t\t\t'" . $DB_LINK->addq($this->credit, get_magic_quotes_gpc()) . "',\n\t\t\t\t'" . $DB_LINK->addq($this->owner, get_magic_quotes_gpc()) . "')";
     $rc = $DB_LINK->Execute($sql);
     DBUtils::checkResult($rc, NULL, $LangUI->_('There was an error inserting the restaurant'), $sql);
     $this->id = DBUtils::getSequenceValue($g_rb_restaurant_id_seq);
     return $this->id;
 }
예제 #2
0
 /**
 	Inserts a new ingredient into the database
 */
 function insert()
 {
     global $db_table_ingredients, $DB_LINK, $g_rb_ingredient_id_seq, $LangUI;
     $sql = "INSERT INTO {$db_table_ingredients}\n\t\t\t\t\t\t\t(ingredient_core,\n\t\t\t\t\t\t\t ingredient_name,\n\t\t\t\t\t\t\t ingredient_desc,\n\t\t\t\t\t\t\t ingredient_unit,\n\t\t\t\t\t\t\t ingredient_location,\n\t\t\t\t\t\t\t ingredient_solid,\n\t\t\t\t\t\t\t ingredient_system,\n\t\t\t\t\t\t\t ingredient_user)\n\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t('" . $DB_LINK->addq($this->core_id, get_magic_quotes_gpc()) . "',\n\t\t\t\t\t\t\t'" . $DB_LINK->addq($this->name, get_magic_quotes_gpc()) . "',\n\t\t\t\t\t\t\t'" . $DB_LINK->addq($this->description, get_magic_quotes_gpc()) . "',\n\t\t\t\t\t\t\t" . $DB_LINK->addq($this->unit, get_magic_quotes_gpc()) . ",\n\t\t\t\t\t\t\t" . $DB_LINK->addq($this->location, get_magic_quotes_gpc()) . ",\n\t\t\t\t\t\t\t'" . $DB_LINK->addq($this->solid, get_magic_quotes_gpc()) . "',\n\t\t\t\t\t\t\t'" . $DB_LINK->addq($this->system, get_magic_quotes_gpc()) . "',\n\t\t\t\t\t\t\t'" . $DB_LINK->addq($this->user, get_magic_quotes_gpc()) . "')";
     // Insert the new ingredient into the database
     $rc = $DB_LINK->Execute($sql);
     DBUtils::checkResult($rc, $LangUI->_('Ingredient Added') . ": " . $this->name, $LangUI->_('There was an error adding the ingredient'), $sql);
     // retrieve incremented sequence value (PostgreSQL)
     $id = DBUtils::getSequenceValue($g_rb_ingredient_id_seq);
     return $id;
 }
예제 #3
0
 /**
 	Insert a new Recipe into the database
 */
 function insert()
 {
     global $db_table_recipes, $DB_LINK, $g_rb_recipe_id_seq, $LangUI;
     // do the Insert
     $sql = "INSERT INTO {$db_table_recipes}\n\t\t\t\t\t\t(recipe_name,\n\t\t\t\t\t\t recipe_ethnic,\n\t\t\t\t\t\t recipe_base,\n\t\t\t\t\t\t recipe_course,\n\t\t\t\t\t\t recipe_prep_time,\n\t\t\t\t\t\t recipe_difficulty,\n\t\t\t\t\t\t recipe_directions,\n\t\t\t\t\t\t recipe_comments,\n\t\t\t\t\t\t recipe_serving_size,\n\t\t\t\t\t\t recipe_source,\n\t\t\t\t\t\t recipe_source_desc,\n\t\t\t\t\t\t recipe_modified,\n\t\t\t\t\t\t recipe_system,\n\t\t\t\t\t\t recipe_private,\n\t\t\t\t\t\t recipe_user)\n\t\t\t\t\tVALUES\n\t\t\t\t\t\t('" . $DB_LINK->addq($this->name, get_magic_quotes_gpc()) . "',\n\t\t\t\t\t\t " . $DB_LINK->addq($this->ethnic, get_magic_quotes_gpc()) . ",\n\t\t\t\t\t\t " . $DB_LINK->addq($this->base, get_magic_quotes_gpc()) . ",\n\t\t\t\t\t\t " . $DB_LINK->addq($this->course, get_magic_quotes_gpc()) . ",\n\t\t\t\t\t\t " . $DB_LINK->addq($this->prep_time, get_magic_quotes_gpc()) . ",\n\t\t\t\t\t\t " . $DB_LINK->addq($this->difficulty, get_magic_quotes_gpc()) . ",\n\t\t\t\t\t\t '" . $DB_LINK->addq($this->directions, get_magic_quotes_gpc()) . "',\n\t\t\t\t\t\t '" . $DB_LINK->addq($this->comments, get_magic_quotes_gpc()) . "',\n\t\t\t\t\t\t " . $DB_LINK->addq($this->serving_size, get_magic_quotes_gpc()) . ",\n\t\t\t\t\t\t " . $DB_LINK->addq($this->source, get_magic_quotes_gpc()) . ",\n\t\t\t\t\t\t '" . $DB_LINK->addq($this->source_desc, get_magic_quotes_gpc()) . "',\n\t\t\t\t\t\t {$this->modified},\n\t\t\t\t\t\t '" . $DB_LINK->addq($this->unitSystem, get_magic_quotes_gpc()) . "',\n\t\t\t\t\t\t '" . $DB_LINK->addq($this->private, get_magic_quotes_gpc()) . "',\n\t\t\t\t\t\t '" . $DB_LINK->addq($this->user, get_magic_quotes_gpc()) . "')";
     $rc = $DB_LINK->Execute($sql);
     DBUtils::checkResult($rc, $LangUI->_('Recipe Successfully created') . ": " . $this->name, $LangUI->_('There was an error inserting the recipe'), $sql);
     // retrieve incremented sequence value
     $this->id = DBUtils::getSequenceValue($g_rb_recipe_id_seq);
     return $this->id;
 }
 /**
 	Save a new shopping list
 */
 function saveNewList($name)
 {
     global $DB_LINK, $db_table_list_recipe, $db_table_list_ingredients, $db_table_list_names, $g_rb_list_id_seq, $SMObj;
     $this->name = $name;
     $name = $DB_LINK->addq($name, get_magic_quotes_gpc());
     $sql = "INSERT INTO {$db_table_list_names} (\n\t\t\t\t\t\tlist_name,\n\t\t\t\t\t\tlist_user)\n\t\t\t\t\tVALUES ('{$name}','" . $SMObj->getUserID() . "')";
     $rc = $DB_LINK->Execute($sql);
     DBUtils::checkResult($rc, NULL, NULL, $sql);
     $this->id = DBUtils::getSequenceValue($g_rb_list_id_seq);
     $this->saveAllItems();
 }