session_start();//读取本地文件$userid=$_SESSION['userid'];//获取用户id$datas=$_POST['datas'];$list=$datas['list'];foreach($listas$v){$mysqli=mysql_query("INSERTINTOwupins...
session_start();//读取本地文件 $userid = $_SESSION['userid']; //获取用户id $datas = $_POST['datas']; $list = $datas['list']; foreach($list as $v){ $mysqli = mysql_query("INSERT INTO wupins (name,bm,userid,time) VALUES ('$v[name]'... session_start();//读取本地文件 $userid = $_SESSION['userid']; //获取用户id $datas = $_POST['datas']; $list = $datas['list']; foreach($list as $v){ $mysqli = mysql_query("INSERT INTO wupins (name,bm,userid,time) VALUES ('$v[name]','$v[bm]','$userid',now())"); //增到到wupins表 $id = mysql_insert_id(); //获取插入的每条数据的id }; $mysqli_is = mysql_query("UPDATE users SET leve='$datas[leve]',jingjie='$datas[jingjie]',qian='$datas[qian]',gj='$datas[gj]',fy='$datas[fy]',xl='$datas[xl]' WHERE Id='$userid'"); //更新user表 $json_arr = array("rows"=>$mysqli_is,"wp_id"=>$id); $json_obj = json_encode($json_arr); echo $json_obj; 我想问的问题: datas是一条json数据,里面有一个list数组; 前端通过轮询的方式一直往这里提交数据(datas),$list里面的数组一直在改变数量,我应该怎么改才不会一直插入重复的数据啊,还有怎么获取插入的每天数据的id 展开
展开