php - Issues updating record using mysqli -
i want update/edit user form, when click "edit" button, i'm not getting expected results. should display new data, displays old data instead.
coding:
<?php include"errorreporting.php"; include "conn.php"; $conn = connect(); $conndb = connectdb(); $wardid = $_request["wardid"]; $requestname = $_request["requestname"]; $department = $_request["department"]; $position = $_request["position"]; $date= $_request["date"]; $typeofrequest = $_request["typeofrequest"]; $pleasespecify = $_request["pleasespecify"]; $daterequire = $_request["daterequire"]; $datereturn = $_request["datereturn"]; mysqli_select_db($conn,"misadmin") or die ($conn->error ."\n"); $query = "select * requestform"; $result2= $conn->query($query) or die ($conn->error ."\n"); $row_result =mysqli_fetch_assoc($result2); mysqli_select_db($conn,"misadmin") or die ($conn->error ."\n"); $conn ->query("update requestform set requestname='$requestname',department='$department',position='$position',date='$date',typeofrequest='$typeofrequest',pleasespecify='$pleasespecify',daterequire='$daterequire',datereturn='$datereturn' wardid='$wardid'",$conn->affected_rows); $result_update=mysqli_fetch_assoc($result); header("location:requestform3.php"); ?>
try it:
$conn ->query("update requestform set requestname='$requestname',department='$department',position='$position',date='$date',typeofrequest='$typeofrequest',pleasespecify='$pleasespecify',daterequire='$daterequire',datereturn='$datereturn' wardid=$wardid ");
Comments
Post a Comment