商品管理录入管理系统

此为后台管理界面:

 $con = mysql_connect("localhost","","");
 mysql_select_db("xinwen", $con);//test改为你的库名
 $k = ($_GET[k]) ? $_GET[k] : 1;
 $dir = array(1=>"添加类别","添加品牌","添加耗材","耗材列表");
 $title = "耗材管理";
 $rs = mysql_query("select * from first order by id");
 $karr = array();
 echo"/r/n";
 if($_POST["kname"]){
  mysql_query("insert into first set name='$_POST[kname]'");
  echo""; return;
 }
 if($_POST["bname"]&&!$_POST["nosub"]){
  mysql_query("insert into second set groupid='$_POST[selk]',name='$_POST[bname]'");
  echo""; return;
 }
 if($_POST["nosub"]){
  echo"/r/n";
  $onload = "οnlοad='init()'";
 }else if($_GET["edid"]){
  echo"/r/n";
  $onload = "οnlοad='init()'";
 }
 if($_POST["p"]){
  echo"/r/n";
  $onload = "οnlοad='init()'";
 }
 if($_POST["xh"]&&!$_GET["edid"]){
  $rs = mysql_query("select name from second where id='$_POST[selb]' and groupid = '$_POST[selk]'");
  $row = @mysql_fetch_row($rs);
  mysql_query("insert into products set groupid='$_POST[selk]',pinpai='$row[0]',pid='$_POST[selb]',
   xinhao='$_POST[xh]',price='$_POST[price]',haocai='$_POST[haocai]'");
  echo""; return;
 }else if($_POST["xh"]&&$_GET["edid"]){
  $rs = mysql_query("select name from second where id='$_POST[selb]' and groupid = '$_POST[selk]'");
  $row = @mysql_fetch_row($rs);
  mysql_query("update products set groupid='$_POST[selk]',pinpai='$row[0]',pid='$_POST[selb]',
   xinhao='$_POST[xh]',price='$_POST[price]',
   haocai='$_POST[haocai]' where id='$_GET[edid]'");
  echo""; return;
 }
 if($_GET["del"]){
  mysql_query("delete from products where id='$_GET[del]'");
  echo""; return;
 }
?>


<?= $title ?>



bgcolor='#f6f6f6'>



 
 
  
  
 

   
    
    
    
    
    
   

  

   >
    
 switch($k){
  case 1:
   echo"
     ";
   break;
  case 2:
   echo"
     
    
     ";
   break;
  case 3:
   echo"
     
    
     
    
     
    
     
    
     ";
   break;
  case 4:
   $p = ($_POST[p]) ? $_POST[p] : 1;
   $lim = 25;
   $where = "where 1=1";
   if($_POST[selg]&&$_POST[selg]!="all") $where .= " and groupid='$_POST[selg]'";
   if($_POST[selpp]&&$_POST[selpp]!="all") $where .= " and pinpai='$_POST[selpp]'";
   $rs = mysql_query("select count(id) as rn from products $where");
   $rn = mysql_result($rs,0,"rn");
   $ps = ceil($rn/$lim);
   echo"
     ";
   $rs = mysql_query("select * from products $where order by groupid desc,haocai desc limit ".($p-1)*$lim.",$lim");
   $haddata=false;
   while($row=@mysql_fetch_array($rs)){
    $haddata=true;
    $key = $row["groupid"];
    $bgcolor = ($lim++%2) ? "#ffffff" : "#f6f6f6";
    echo"
     
     
     
     ";
   }
   if(!$haddata) echo"";
   echo"";
   break;
  default: break;
 }
 if($k<4) echo"";

?>

类别名
类别
品牌名
类别
品牌名
适用机型
价格
耗材
编号分类品牌适用机型耗材型号价格编辑删除
$row[id]$karr[$key]$row[pinpai]$row[xinhao]$row[haocai]$row[price]      οnclick=/"location='?k=3&edid=$row[id]'/">?      οnclick=/"if(confirm('您确定要删除吗?'))location=location+'&del=$row[id]'/">r
没有符合查询条件的数据!

    分类查询: 
            
    共有数据{$rn}行/{$ps}页    ";
    if($p>1) echo"";
    echo"上一页
 ";
    if($p<$ps) echo"";
    echo"下一页
 
      
   
  


你可能感兴趣的:(javascript,mysql,query,function,insert,table)