首页 > 解决方案 > 更新语句未更新表数据(未回答)

问题描述

我正在尝试使用 mysql.MY 中的 Update 语句更新员工的记录。我的查询显示消息“员工记录已成功更新”但它没有在表中更新我的代码是这样的

{
$eid=intval($_GET['uin']);
$uin=$_POST['uin'];
$fname=$_POST['firstName'];
$lname=$_POST['lastName'];   
$email=$_POST['email']; 
$department=$_POST['department']; 
$recoffr=$_POST['recoffr']; 
$mobileno=$_POST['mobileno'];
$sql="
update tblemployees 
   set FirstName = :fname
     , LastName = :lname
     , email = :email
     , department = :department
     , recoffr = :recoffr
     , Phonenumber = :mobileno 
 where uin = :eid
";
$query = $dbh->prepare($sql);
$query->bindParam(':eid',$uin,PDO::PARAM_STR);
$query->bindParam(':fname',$fname,PDO::PARAM_STR);
$query->bindParam(':lname',$lname,PDO::PARAM_STR);
$query->bindParam(':email',$email,PDO::PARAM_STR);
$query->bindParam(':department',$department,PDO::PARAM_STR);
$query->bindParam(':recoffr',$recoffr,PDO::PARAM_STR);
$query->bindParam(':mobileno',$mobileno,PDO::PARAM_STR);
$query->execute();
$msg="Employee record updated Successfully";

}

我的表结构是表结构

标签: phpmysqlsqldatabase

解决方案


推荐阅读