You are here

function BotchaRecipeModel::save in BOTCHA Spam Prevention 6.2

Same name and namespace in other branches
  1. 6.3 model/recipe/botcha.recipe.model.inc \BotchaRecipeModel::save()
  2. 7.2 model/botcha_recipe.model.inc \BotchaRecipeModel::save()
  3. 7.3 model/recipe/botcha.recipe.model.inc \BotchaRecipeModel::save()
1 call to BotchaRecipeModel::save()
BotchaRecipe::save in controller/botcha_recipe.controller.inc

File

model/botcha_recipe.model.inc, line 33
Contains BotchaRecipeModel class.

Class

BotchaRecipeModel
@file Contains BotchaRecipeModel class.

Code

function save($recipe) {

  // Save recipe to DB.
  if (db_result(db_query("SELECT COUNT(*) FROM {botcha_recipe} br WHERE br.id = '%s'", array(
    $recipe->id,
  )))) {
    db_query("UPDATE {botcha_recipe} SET classname = '%s', title = '%s', description = '%s' WHERE id = '%s'", array(
      $recipe->classname,
      $recipe->title,
      $recipe->description,
      $recipe->id,
    ));
  }
  else {
    db_query("INSERT INTO {botcha_recipe} (id, classname, title, description) VALUES('%s', '%s', '%s', '%s')", array(
      $recipe->id,
      $recipe->classname,
      $recipe->title,
      $recipe->description,
    ));
  }
}