You are here

function _dynamic_banner_set_banner in Dynamic Banner 6

Set a banner for a given path, preventing duplicates. Note if dbid comes in null then we are creating a banner

1 call to _dynamic_banner_set_banner()
dynamic_banner_admin_form_submit in includes/callbacks.inc
Save a new Banner to the database.

File

includes/callbacks.inc, line 251
Dynamic Banner Admin Pages and various other functions to make them work Most of the code in this file was derived from path module

Code

function _dynamic_banner_set_banner($path = NULL, $imgurl = NULL, $text = NULL, $link = NULL, $dbid = NULL) {

  // First check if we are dealing with an existing banner or a new one
  if ($dbid) {

    // Update the existing banner.
    db_query("UPDATE {dynamic_banner} SET path ='%s', imgurl ='%s', text ='%s', link ='%s' WHERE dbid ='%d'", $path, $imgurl, $text, $link, $dbid);
  }
  else {

    // A new banner. Add it to the database.
    db_query("INSERT INTO {dynamic_banner} (path, imgurl, text, link) VALUES ('%s', '%s', '%s', '%s')", $path, $imgurl, $text, $link);
  }
}