<?php
if ("" != $_SESSION['Firma']['Feld1_Name'])
{
	$Feld1 = "Feld1 = \"" . addslashes($_POST['Feld1']) . "\",";
}
else
{
	$Feld1 = "";
}
if ("" != $_SESSION['Firma']['Feld2_Name'])
{
	$Feld2 = "Feld2 = \"" . addslashes($_POST['Feld2']) . "\",";
}
else
{
	$Feld2 = "";
}
if ("" != $_SESSION['Firma']['Feld3_Name'])
{
	$Feld3 = "Feld3 = \"" . addslashes($_POST['Feld3']) . "\",";
}
else
{
	$Feld3 = "";
}
if ("" != $_SESSION['Firma']['Feld4_Name'])
{
	$Feld4 = "Feld4 = \"" . addslashes($_POST['Feld4']) . "\",";
}
else
{
	$Feld4 = "";
}
if ("" != $_SESSION['Firma']['Feld5_Name'])
{
	$Feld5 = "Feld5 = \"" . addslashes($_POST['Feld5']) . "\",";
}
else
{
	$Feld5 = "";
}
$sql = "INSERT INTO " . PREFIX . "_Artikel SET
			ID			= 	NULL,
			Bezeichnung =	\"" . $_POST['Bezeichnung'] . "\",
			" . $Feld1 . "
			" . $Feld2 . "
			" . $Feld3 . "
			" . $Feld4 . "
			" . $Feld5 . "
			Datum		=	CURDATE(),
			Preis =			\"" . $_POST['Preis'] . "\";";
$stmt = $db->prepare($sql);
if (!$stmt)
{
	die ('Datensatz konnte nicht gespeichert werden: ' . $db->error);
}
if (!$stmt->execute())
{
	die ('Datensatz konnte nicht gespeichert werden: ' . $stmt->error);
}
