Chinaunix首页 | 论坛 | 博客
  • 博客访问: 289501
  • 博文数量: 176
  • 博客积分: 2516
  • 博客等级: 少校
  • 技术积分: 1350
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-01 11:18
文章分类
文章存档

2011年(1)

2010年(18)

2009年(157)

我的朋友

分类:

2009-05-20 16:01:19

modify.php:
    $link = mysql_connect("localhost:3306", "root", "lili0921")
        or die("Could not connect : " . mysql_error());
    mysql_select_db("ykjd",$link) or die("Could not select database");
    echo "

数据库管理系统

";
    parse_str($_SERVER['QUERY_STRING']);
    $query = "SELECT * FROM products WHERE id = '$id'";
    $result = mysql_query($query) or die("Query failed : " . mysql_error());
    $Rnum = mysql_num_fields($result);
?>
  

 if($row){
         for($i = 0; $i < $Rnum;$i++ ) {
             switch($i){
    case 0:
     echo "ID:";
     echo "
";
     break;
    case 1:
     echo "serial:";
     
     echo "
";
     break;
    case 2:
     echo "posttime:";
     echo "  填写方式:2007-01-23 11:21:08";
     echo "
";
     break;
    case 3:
     echo "postbatch:";
     echo "
";
     break;
    case 4:
     echo "userfingerno:";
     echo "
";
     break;
    case 5:
     echo "userregistertime:";
     echo "  填写方式:2007-01-23 11:21:08";
     echo "
";
     break;
    case 6:
     echo "userhistory:";
     echo "
";
     break;
    case 7:
     echo "username:";
     echo "
"; 
     break;
    case 8:
     echo "usercom:";
     echo "
";
     break;
    case 9:
     echo "usertel:";
     echo "
";
     break;
   }
         }
 }
  
?>
 
 

    mysql_free_result($result);
    mysql_close($link);
?>
add.php:

 

数据库管理系统


 


 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

 

 

 
 

 

 
 

 

 
 

 

 
 

 

 
 

 

 serial:
 

 posttime
 

 postbatch:
 

 userfingerno:
 

 userregistertime:
 

 userhistory:
 

 username:
 

 usercom:
 

 usertel:
 

 
 
 




 返回上一页

check.php

 

数据库管理系统


 

 用户名:
 

 密码:   
 

 
 
 



delete.php
    $link = mysql_connect("localhost:3306", "root", "lili0921")
        or die("Could not connect : " . mysql_error());
    mysql_select_db("ykjd",$link) or die("Could not select database");
    parse_str($_SERVER['QUERY_STRING']);
    $query = "delete from products where id = '$id'";
    $result = mysql_query($query) or die("Query failed : " . mysql_error());
    if($result){
  echo "删除成功,正在转回...";
?>
  
  
  
  
  
  
  
  }
  else{
 echo "删除失败,正在返回...";
mysql_close($link);
?>
find.php
    $link = mysql_connect("localhost:3306", "root", "lili0921")
        or die("Could not connect : " . mysql_error());
    echo "

数据库管理系统

";
    mysql_select_db("ykjd",$link) or die("Could not select database");
    $query = "SELECT * FROM products WHERE serial='$_POST[findserial]'";
    $result = mysql_query($query) or die("Query failed : " . mysql_error());
    $Rnum = mysql_num_fields($result);   
?>               
                        
        
                          echo "";
                          for($i = 0;$i < $Rnum;$i++){
                                  $str = mysql_field_name($result,$i);
  ?>                             
                            }      
                          echo "";
                          while($row = mysql_fetch_row($result)){
                                  $j++;
                                  echo "";
                                  for($i = 0;$i < $Rnum; $i++){
                                          echo "";
                                  }      
                          }
                          echo "";
      echo "返回首页"
  ?>                     
$row[$i]

 
   
    mysql_free_result($result);
    mysql_close($link);
?>
getpasswd.php
if ($_SERVER['REQUEST_METHOD'] == 'POST'){
?>
 

 $link = mysql_connect("localhost:3306", "root", "lili0921")
           or die("Could not connect : " . mysql_error());
        echo "Connected successfully";
?>
 

        mysql_select_db("ykjd",$link) or die("Could not select database");
   echo "dsaf";
        $query = "SELECT * FROM user WHERE username = '$_POST[username]'";
        print "\n";
        $result = mysql_query($query) or die("Query failed : " . mysql_error());
 echo "kksf";
?>
 

  
  
 

  echo "
";
         echo "asdf";
  $row = mysql_fetch_row($result);
  echo "$row[1]";
  echo "$_POST[password]";
           if($row[1] == $_POST[password]){
   echo "h1";
   mysql_free_result($result);
   $query = "SELECT * FROM products order by id asc";
   $result = mysql_query($query) or die("Query failed :" . mysql_error());
   $Rnum = mysql_num_fields($result);
  
?>
   
  
   echo "";
   for($i = 0;$i < $Rnum;$i++){
    $str = mysql_field_name($result,$i);
?>    
   }
   echo "";
   $j = 1;
   while(($row = mysql_fetch_row($result)) && ($j <= 10)){
    $j++;
    echo "";
    for($i = 0;$i < $Rnum; $i++){
     echo "";
    } 
    echo "";
    echo "";
   }
   echo "";
   
?>   
$row[$i]删除修改
    
  echo "添加   ";
  echo "上一页   ";
  echo "下一页";
 
 
        mysql_free_result($result);
        mysql_close($link);
}
?>
realadd.php
$link = mysql_connect("localhost:3306", "root", "lili0921")or die("Could not connect : " . mysql_error());
mysql_select_db("ykjd",$link) or die("Could not select database");
//$posttime = date('Y-m-d G:I:s',$_POST[posttime]);
//$userregistertime = date('Y-m-d H:I:s',$_POST[userregistertime]);
if($_POST[id]){
 $query = "select id from products where id='$_POST[id]'";
 $result = mysql_query($query);
 if($result){
 mysql_free_result($result);
 $query = "delete from products where id='$_POST[id]'";
 $result = mysql_query($query) or die("Query failed : " . mysql_error());
 $query = "insert into products values('$_POST[id]','$_POST[serial]','$_POST[posttime]','$_POST[postbatch]','$_POST[userfingerno]','$_POST[userregistertime]','$_POST[userhistory]','$_POST[username]','$_POST[usercom]','$_POST[usertel]')"; 
 }
 else {
  mysql_free_result($result);
  $query = "insert into products values('$_POST[id]','$_POST[serial]','$_POST[posttime]','$_POST[postbatch]','$_POST[userfingerno]','$_POST[userregistertime]','$_POST[userhistory]','$_POST[username]','$_POST[usercom]','$_POST[usertel]')";
 }
}
else{
 $query = "select id from products";
 $result = mysql_query($query) or die("Query failed : " .mysql_error());
 for($j = 1;$row = mysql_fetch_row($result);$j++){
  if($row[0] != $j) break;
 }
 
 $query = "insert into products values('$j','$_POST[serial]','$_POST[posttime]','$_POST[postbatch]','$_POST[userfingerno]','$_POST[userregistertime]','$_POST[userhistory]','$_POST[username]','$_POST[usercom]','$_POST[usertel]')";
}
$result = mysql_query($query);
if($result){
 echo "记录添加成功,正在返回.....";
?>
       
 
       
        "; ?>
       
       
       
       
}
else
{
 echo "填写有错误,请重新填写...";
?> 
 
 
 
 
 
 
 
 
}
?>
mysql_close($link);
?>
view.php
?>
 $link = mysql_connect("localhost:3306", "root", "lili0921")
           or die("Could not connect : " . mysql_error());
        echo "

数据库管理系统

";
?>
        mysql_select_db("ykjd",$link) or die("Could not select database");
?>
 

  
  
 

   if($opt){
    switch($opt){
     case 1:
      $id = $id - 10;
      $query = "SELECT * FROM products where id >'$id' order by id asc";
      break;
     case 2:
      $query = "select * from products where id > '$id' order by id asc";
      break;
     
    }
   } else {
    $query = "select * from products order by id asc";
   }
   $result = mysql_query($query) or die("Query failed :" . mysql_error());
   $Rnum = mysql_num_fields($result);
  
?>
   
  
   echo "";
   for($i = 0;$i < $Rnum;$i++){
    $str = mysql_field_name($result,$i);
?>    
   }
   echo "";
   $j = 1;
   while(($row = mysql_fetch_row($result)) && ($j <= 10) ){
    $j++;
    echo "";
    for($i = 0;$i < $Rnum; $i++){
     echo "";
    } 
    echo "";
    echo "";
   }
   echo "";
   
?>   
$row[$i]删除修改
    
  $opt1 = 1;
  $opt2 = 2;
  echo "添加   ";
  ?>
  &opt=1>上一页   
  &opt=2>下一页
 
mysql_free_result($result);
mysql_close($link);
?>
阅读(336) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~