Location: PHPKode > projects > Einkaufszettelgenerator > EZettel0.1/prod_to_db.php
<?
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">
<title>Product - to db</title>

</head>
<body class="body1">
<?
include("menu.ini");
$strsql_t = "select typ_id from prod_type where (typ_name='$_POST[prod_type]' and user_id='$us');";
$result_t = mysql_query($strsql_t, $connection);
   $j=0;
    while ( $row = mysql_fetch_row($result_t) )
       {
        $j+=1;
       $_POST[prod_type]=$row[0]; 
        }           


$strsql_m = "select markt_id from markt where (markt_name='$_POST[markt]' and user_id='$us');";
$result_m = mysql_query($strsql_m, $connection);
   $m=0;
    while ( $row = mysql_fetch_row($result_m) )
       {
        $m+=1;
       $_POST[markt]=$row[0]; 

        }




 $strsql = "insert into product (prod_name, prod_type, prod_price, markt,menge,const,user_id) VALUES ('$_POST[prod_name]','$_POST[prod_type]','$_POST[prod_price]','$_POST[markt]','$_POST[menge]', '$_POST[const]','$us');";

 $result = mysql_query($strsql);  


echo "<TABLE border=1 align=center CELLSPACING=0 CELLPADDING=5i class=prod><TR class=table><TD>Название продукта</TD><TD>Тип</TD><TD>Цена</TD><TD>Магазин</TD><TD>Покупать всегда</TD><TR>";
   $strsql1 = "select p.prod_name,t.typ_name, p.prod_price,p.markt, p.const from product p, prod_type t where (t.typ_id=p.prod_type) and p.user_id='$us' and t.user_id='$us' ORDER BY p.prod_type;"; 
   $result1 = mysql_query($strsql1, $connection);
   $i=0;
    while ( $row = mysql_fetch_row($result1) )
       {
        $i+=1;

echo "<TR><TD>$row[0]</TD><TD>$row[1]</TD><TD>$row[2]</TD>";

$strsql_mn = "select markt_name from markt where (markt_id='$row[3]');";
$result_mn = mysql_query($strsql_mn, $connection);
   $n=0;
    while ( $row_mn = mysql_fetch_row($result_mn) )
       {
        $n+=1;
       $row[3]=$row_mn[0]; 

        }


echo "<TD>$row[3]</TD><TD>$row[4]</TD><TR>";
       }

?> 
</TABLE>    
<center><A HREF=input.php>Ввести новый продукт</a>&nbsp;&nbsp;<A HREF=start.php>На первую страницу</A>&nbsp;&nbsp;<A HREF=edit.php>Редактировать список продуктов</A></center> 
Return current item: Einkaufszettelgenerator