老师,删除时,在doAction.php中,$username=$_POST['username'];这种语句运行出错!
老师,删除时,在doAction.php中,$username=$_POST['username'];这种语句运行出错!
后来我把下面的代码放到Switch的case中,就可以了。为什么老师您放在最上面,没有出错呢?
------------------------------------
$username=$_POST['username'];
$username=$mysqli->escape_string($username);
$password=md5($_POST['password']);
$age=$_POST['age'];
----------------------------------
switch ($act){
case 'addUser':
//echo "添加用户操作";
$username=$_POST['username'];
$username=$mysqli->escape_string($username);
$password=md5($_POST['password']);
$age=$_POST['age'];
$sql="INSERT INTO `user`(`username`,`password`,`age`) values('{$username}','{$password}','{$age}')";
$res=$mysqli->query($sql);