<?
session_start();
$us= $HTTP_SESSION_VARS['uid'];
//echo "user=$us<br>";
?>
<HTML>
<LINK REL="stylesheet" TYPE="text/css" HREF="menu.css">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body class="speise">
<?
include("menu.ini");
$strsql_t = "select type_id from speise_type where (type_name='$_POST[speise_type]' and user_id='$us');";
$result_t = mysql_query($strsql_t, $connection);
$j=0;
while ( $row = mysql_fetch_row($result_t) )
{
$j+=1;
$_POST[speise_type]=$row[0];
}
$strsql = "update speise SET speise_name='$_POST[speise_name]', speise_type='$_POST[speise_type]', speise_recept='$_POST[speise_recept]', user_id='$us' where speise_id='$_POST[speise_id]';";
//echo "str= $strsql<br>";
$result = mysql_query($strsql, $connection);
$strsql_del = "delete from teil where speise_id='$_POST[speise_id]';";
//echo "str_del = $strsql_del <P>";
$result_del = mysql_query($strsql_del, $connection);
for ($k = 1; $k <= 10; $k++)
{
$prod_id="prod_id_$k";
// echo "k=$k<br>";
// echo "POST[$prod_id]=$_POST[$prod_id]<P>";
if ($_POST[$prod_id]!='')
{
//echo "prod_type=$_POST[$prod_type]<P>";
//echo "prod_id=$_POST[$prod_id]<P>";
$strsql_2 = "select prod_id from product where (prod_name='$_POST[$prod_id]');";
// echo "str_2= $strsql_2<br>";
$result_2 = mysql_query($strsql_2, $connection);
$t=0;
while ( $row_2 = mysql_fetch_row($result_2) )
{
$t+=1;
$_POST[$prod_id]=$row_2[0];
// echo "new POST[$prod_id]=$_POST[$prod_id]<P>";
// echo "speise_name =$_POST[speise_name]<P>";
$strsql_4 = "Insert into teil (speise_id, prod_id) Values ('$_POST[speise_id]','$_POST[$prod_id]');";
//echo "str_4 = $strsql_4 <P>";
$result_4 = mysql_query($strsql_4, $connection);
}
}
}
$strsql_5 = "select p.speise_name,p.speise_id, t.type_name ,p.speise_recept from speise p, speise_type t where ( (p.speise_name='$_POST[speise_name]') and (p.speise_type=t.type_id) and p.speise_id='$_POST[speise_id]' and t.user_id='$us');";
// echo "str_5=$strsql_5<br>";
$result_5 = mysql_query($strsql_5, $connection);
$r=0;
while ( $row_5 = mysql_fetch_row($result_5) )
{
$r+=1;
echo "<center><B>$row_5[0]</B><BR>$row_5[2]</center><P>";
echo "<B>СоÑÑав</B>:";
$strsql_6 = "select p.prod_name from product p, teil t where ( (t.speise_id='$_POST[speise_id]')&&(p.prod_id=t.prod_id));";
$result_6 = mysql_query($strsql_6, $connection);
$z=0;
while ( $row_6 = mysql_fetch_row($result_6) )
{
$z+=1;
echo "$row_6[0] ";
}
echo "<P><BLOCKQUOTE>$row_5[3]</BLOCKQUOTE><P>";
}
?>
<center><A HREF=input_speise.php>ÐвеÑÑи новÑй ÑеÑепÑ</a> <A HREF=start.php>Ðа пеÑвÑÑ ÑÑÑаниÑÑ</a></center>
</HTML>