zoukankan      html  css  js  c++  java
  • source code of MES Data

    <HTML>
    <HEAD>
    <TITLE>TELOGS</TITLE>
    </HEAD>
    <BODY>
    <?php
    	/* command line parameters:  wget "http://localhost/query.php?action=query&sn=123" -O get1.html */
    
    	$act=$_GET["action"];
    	/* http://localhost/query.php?action=query&sn=123  */
    	if ($act == "query"){
    		$serialnumber=$_GET["sn"];
    		
    		$con = mysql_connect("localhost","root","123456");
    		if (!$con){
    			die('Could not connect: ' . mysql_error());
    		}
    
    		mysql_select_db("test", $con);
    		$sql = "SELECT * FROM testlogs where Serial_number='$serialnumber'";
    		$result = mysql_query($sql);
    		if (mysql_num_rows($result) != "0" ){
    			while($row = mysql_fetch_array($result))
    			{
    				echo $row['Serial_number'] . "|" . $row['Mac_addr']."|". $row['OA_KEY']."
    ";
    			}
    		}else{
    			echo "No data of this serial number=".$serialnumber;
    		}
    		mysql_close($con);
    	}
    ?>
    
    <?php
    	/* http://localhost/query.php?action=add&sn=123&mac=eeee&oakey=123   */
    	if ($act == "add"){
    
    		$serialnumber=$_GET["sn"];
    		$macaddr=$_GET["mac"];
    		$oakey=$_GET["oakey"];
    		
    		$con = mysql_connect("localhost","root","123456");
    		if (!$con){
    			die('Could not connect: ' . mysql_error());
    		}
    
    		mysql_select_db("test", $con);
    		$sql="INSERT INTO testlogs (Serial_number, Mac_addr, OA_KEY) values ('$serialnumber','$macaddr','$oakey')";
    		if(mysql_query($sql)){
    			echo "Add data Passed";
    		}else{
    			echo "Add data failed";
    		}
    		mysql_close($con);
    	}
    ?>
    </BODY>
    </HTML>

    版权声明:本文博主原创文章。博客,未经同意不得转载。

  • 相关阅读:
    从一个故障说说Java的三个BlockingQueue
    kafka producer源码
    Mock方法介绍
    async4j 普通用法、整合spring用法
    Spring中属性文件properties的读取与使用
    异步框架asyn4j的原理
    如何从线程返回信息——轮询、回调、Callable
    jdk 1.8 Executors
    java Iterator Fail-fast机制
    java的几种对象(PO,VO,DAO,BO,POJO)解释
  • 原文地址:https://www.cnblogs.com/hrhguanli/p/4776317.html
Copyright © 2011-2022 走看看