开发者社区> 问答> 正文

数据已在数据库中更新,但有错误1

在我的系统中,我具有更新数据的功能。单击“更新”按钮后,数据将在数据库中更新,但它还会显示如下错误:


PHP注意:未定义的变量:C:\ inetpub \ wwwroot \ tgotworker \ pages \ manage_engineer_admin \ edit_engineer_admin.php中的全名

PHP注意:未定义变量:C:\ inetpub \ wwwroot \ tgotworker \ pages \ manage_engineer_admin \ edit_engineer_admin.php中的role_id

PHP注意:未定义变量:C:\ inetpub \ wwwroot \ tgotworker \ pages \ manage_engineer_admin \ edit_engineer_admin.php中的role_id

PHP注意:未定义的变量:C:\ inetpub \ wwwroot \ tgotworker \ pages \ manage_engineer_admin \ edit_engineer_admin.php中的team_id

PHP注意:未定义的变量:C:\ inetpub \ wwwroot \ tgotworker \ pages \ manage_engineer_admin \ edit_engineer_admin.php中的team_id

下面是我的代码:

<?php
$sql = "";
require_once "../../config/configPDO.php";
require_once "../../config/check.php";

if(isset($_POST['update']))
{   
  $badgeid = $_POST['badgeid'];

  // checking empty fields
  if(empty($badgeid)) { 

    if(empty($badgeid)) {
      echo "<font color='red'>Fac_Name field is empty.</font><br/>";
    }

  } else {  
    //updating the badgeid
    $sql = "UPDATE users SET roles_id = :roles_id, team_id = :team_id WHERE badgeid = :badgeid";
    $query = $conn->prepare($sql);

    $query->bindParam(':roles_id', $_POST['roles_id']);
    $query->bindParam(':team_id', $_POST['team_id']);
    $query->bindParam(':badgeid', $_POST['badgeid']);
    $query->execute();

    //redirectig to the display page. In our case, it is index.php
    header("Location: ../dashboard/dashboard_super_admin.php");
  }
}

//getting id from url
$badgeid = $_GET['badgeid']; //line 33

//selecting data associated with this particular id
$sql = "SELECT * FROM users LEFT JOIN roles on users.roles_id = roles.roles_id WHERE badgeid = :badgeid";
$query = $conn->prepare($sql);

展开
收起
社区秘书 2019-12-09 15:58:02 594 0
0 条回答
写回答
取消 提交回答
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
DTCC 2022大会集锦《云原生一站式数据库技术与实践》 立即下载
阿里云瑶池数据库精要2022版 立即下载
2022 DTCC-阿里云一站式数据库上云最佳实践 立即下载