数据未能修改,感觉SQL出了问题。
程序代码:
$conn = mysqli_connect($servername, $username, $password, $dbname); mysqli_set_charset($conn, "utf8"); // Check connection if (!$conn) { die("连接失败: " . mysqli_connect_error()); } if(isset($_POST['inoutid'])){ $inoutid=$_POST['inoutid']; echo "所要修改数据的ID是:".$inoutid; $dept=$_POST['dept']; $chemnameid = $_POST['chemnameid']; $numbers =$_POST['numbers']; $date=$_POST['date']; $remarks= $_POST['remarks']; $sqlupdate="UPDATE table_cheminout SET chemnameid=$chemnameid,numbers=$numbers,dept=$dept,date=$date,remarks=$remarks WHERE inoutid=$inoutid"; mysqli_query($conn ,$sqlupdate); echo "<br>修改成功"; } mysqli_close($conn); ?> <div id=form> <div id=formin> <h>修改此ID的数据</h> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST"> 待修改ID<input type="number" name="inoutid"><br> 部    门:<select name="dept"> <option value="ZY">ZY</option> <option value="YY">YY</option> </select ><br> 化学品ID<input type="number" name="chemnameid"><br> 数    量:<input type="number" name="numbers"><br> 日    期: <input type="date" name="date"><br> 备    注:<input type="text" name="remarks" ><br> <input type="reset" value="重置"> <input type="submit" value="提交"> </form>