Location: PHPKode > scripts > GigKalender > calendar/functions_artists.php
<?php
/*
    CREATIVE COMMONS - Attribution-No Derivative Works 3.0 Germany:
    - You may not alter, transform, or build upon this work.
    - Dieses Werk darf nicht bearbeitet oder in anderer Weise verändert werden.
*/
function getArtistVarFromArtistVar ($FieldName, $FieldValue, $Var)
{
  global $prefix;
  $SQL = "SELECT ".$Var." FROM ".$prefix."artists WHERE ".$FieldName."='".$FieldValue."' LIMIT 1";
  $result = mysql_query($SQL);
  if ( mysql_num_rows($result)==1)
  {
    $temp=mysql_fetch_assoc($result);
    return $temp[$Var];
  }
  else return false;
}

function getArtistVarFromArtistID ($ArtistID, $Var)
{
  global $prefix;
  $SQL = "SELECT ".$Var." FROM ".$prefix."artists WHERE ArtistID='".$ArtistID."' LIMIT 1";
  $result = mysql_query($SQL);
  if ( mysql_num_rows($result)==1)
  {
    $temp=mysql_fetch_assoc($result);
    return $temp[$Var];
  }
  else return false;
}

function isArtistInDatabase($ArtistName)
{
  global $prefix;
  $doppelteVorhanden = false;
  $string = strtolower($ArtistName);
  //$db_select = @mysql_select_db($db_name);
  $sql = 'SELECT * FROM ' .$prefix."artists";
  $result = mysql_query($sql);
  $menge = mysql_num_rows($result);
  while($row = mysql_fetch_row($result))
    if (strtolower($row[1]) == $string) $doppelteVorhanden = true;
  if ($doppelteVorhanden) return true;
  else return false;
}

function addArtist ( $Artist, $Job )
{
  global $prefix;
  global $L_042;
  $amountArtists = count($Artist);
  for ($i=0; $i<$amountArtists; $i++)
    if ( $i!=23 ) // Notizen werden ausgeklammert
      $Artist[$i]=strip_tags($Artist[$i]); // Entfernt HTML- und PHP-Tags aus einer Zeichenkette
  list( $ArtistID, $ArtistName, $ArtistURL) = $Artist;
  if ( $ArtistURL=='http://' ) $ArtistURL='';
  if ( $ArtistURL!="" AND !stristr( $ArtistURL, 'http://' ) ) $ArtistURL = 'http://'.$ArtistURL;
  if ( $Job=="add" )
  {
    $SQL = "INSERT INTO ".$prefix."artists ( ArtistName, ArtistURL ) VALUES ( '$ArtistName', '$ArtistURL' )";
    $resultat = mysql_query($SQL);
    if ($resultat) return true;
      else return false;
  }
  elseif ( $Job=="edit" )
  {
    $SQL = "UPDATE ".$prefix."artists SET ArtistName = '$ArtistName', ArtistURL = '$ArtistURL'
      WHERE ArtistID = '$ArtistID' LIMIT 1";
    $resultat = mysql_query($SQL);
    if ($resultat) return true;
      else return false;
  }
}

function AmountOfArtistsInDatabase ()
  {
    global $prefix;
    $sql = "SELECT count(*) as zahl  FROM ".$prefix."artists";
    $result = mysql_query($sql);
    $row = mysql_fetch_array($result);
    return $row['zahl'];
  }
?>
Return current item: GigKalender