test2
This commit is contained in:
6
test.php
6
test.php
@@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
header("Content-Type: text/html;charset=utf-8");
|
header("Content-Type: text/html;charset=utf-8");
|
||||||
$userIp = $_SERVER["REMOTE_ADDR"];
|
$userIp = $_SERVER["REMOTE_ADDR"];
|
||||||
$timeend = date("H:i:s");
|
$timeend = date("H:i:s");
|
||||||
//时间差
|
//时间差
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
//link to mysql
|
//link to mysql
|
||||||
$con = mysqli_connect("localhost","buptStudent","buptStudentlx","buptStudentdb");
|
$con = mysqli_connect("localhost","buptStudent","buptStudentlx","buptStudentdb");
|
||||||
if (!$con){die('Could not connect: '.mysql_error());}
|
if (!$con){die('Could not connect: '.mysql_error());}
|
||||||
mysql_select_db("my_db_test", $con);
|
//mysql_select_db("my_db_test", $con);
|
||||||
//name & student_id
|
//name & student_id
|
||||||
$chongfu="SELECT Student_ID FROM UserAnswer WHERE Student_ID=$_POST[student_id]";
|
$chongfu="SELECT Student_ID FROM UserAnswer WHERE Student_ID=$_POST[student_id]";
|
||||||
if(mysql_fetch_array(mysql_query($chongfu,$con))[0]==$_POST[student_id])
|
if(mysql_fetch_array(mysql_query($chongfu,$con))[0]==$_POST[student_id])
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
// mysql_query($sql3,$con);
|
// mysql_query($sql3,$con);
|
||||||
// }
|
// }
|
||||||
$c= "aq_".$i;
|
$c= "aq_".$i;
|
||||||
$d=$_POST[$a]+$_POST[$b]*10;
|
$d=$_POST[$a]+$_POST[$b]*10;
|
||||||
$sql5 = "UPDATE UserAnswer SET $c=$d WHERE Student_ID=$_POST[student_id]";
|
$sql5 = "UPDATE UserAnswer SET $c=$d WHERE Student_ID=$_POST[student_id]";
|
||||||
if (!mysql_query($sql5,$con))
|
if (!mysql_query($sql5,$con))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user