You are here

function currency_api_save in Currency 6

Same name and namespace in other branches
  1. 5 currency_api/currency_api.module \currency_api_save()
  2. 7 currency_api/currency_api.module \currency_api_save()

Cache rate for from and to countries delete outdated record, if exists.

Parameters

string $currency_from:

string $currency_to:

decimal $rate:

Return value

A database query result resource, or FALSE if the query was not executed correctly.

1 call to currency_api_save()
currency_api_convert in currency_api/currency_api.module
Currency exchange rate API function.

File

currency_api/currency_api.module, line 383
This module provides an API for currency conversion.

Code

function currency_api_save($currency_from, $currency_to, $rate) {

  // Delete outdated record, if exists.
  db_query("DELETE FROM {currencyapi} WHERE currency_from = '%s' AND currency_to = '%s'", $currency_from, $currency_to);
  return db_query("INSERT INTO {currencyapi} VALUES ('%s', '%s', %f, %d)", $currency_from, $currency_to, $rate, time());
}