我的代码在这里,我的代码有问题,它无法更新我的表状态和req_acknowledge?谁来帮帮我。这就是我的系统运行,当我点击“关闭”按钮时,我的表状态将更新为“已关闭确认”,当状态等于可用反馈时“如果没有,则状态没有任何变化..
<?php
if(isset($_POST['try'])){
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "elev8groupportal";
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$req_status = mysqli_real_escape_string($conn, $_POST['req_status']);
$sql = "UPDATE request SET req_status='Closed-Acknowledgement', req_acknowledge=NOW() WHERE req_code = '".$_POST['req_code201']."' and req_status= 'Feedback Available'"or die (mysql_error()
);
if ($conn->query($sql) === TRUE) {
echo "Record updated successfully";
} else {
echo "Error updating record: " . $conn->error;
}
$conn->close();
}
?>
<form>
Company: <input type="text" value="<?php echo ($dn1['comp_name']); ?>" size="50" readonly></input><br><br>
Type of Request: <input type="text" value="<?php echo ($dn1['itrf_type']); ?>" size="50" readonly><br><br>
Date Needed: <input type="text" value="<?php echo ($dn1['req_dateneeded']); ?>" size="50" readonly></input><br><br>
Project Details: <textarea name="textarea" rows="2" value="" cols="50" readonly><?php echo ($dn1['itrf_details']); ?></textarea><br><br>
FORM STATUS: <input type="" value="<?php echo ($dn1['req_status']); ?>" size="50" readonly></input><br><br>
_________________________________________________________________________________________________________________
<label> Approver Comment:</label><br>
<i><textarea rows="3" cols="50" width="100px" id="noter_comment" name="noter_comment" align="right" readonly><?php echo ($dn1['app_comment']); ?></textarea><br /></i>
<label> Noter Comment</label><br>
<i><textarea rows="3" cols="50" width="100px" id="noter_comment" name="noter_comment" align="right" readonly><?php echo ($dn1['noter_comment']); ?></textarea><br /></i>
<label>Request Feedback</label><br>
<textarea rows="3" cols="50" width="100px" id="TRF_comment" name="TRF_comment" align="right" readonly><?php echo ($dn1['TRF_comment']); ?></textarea><br /><br />
<button type="submit" class="btn btn-primary" name="try" id="try" >Close Form</button>
</form>
</div>
答案 0 :(得分:0)
我认为这无效:
$sql = "UPDATE request SET req_status='Closed-Acknowledgement', req_acknowledge=NOW() WHERE req_code = '".$_POST['req_code201']."' and req_status= 'Feedback Available'"or die (mysql_error()
);
删除ro die bullshit:
$sql = "UPDATE request SET req_status='Closed-Acknowledgement', req_acknowledge=NOW() WHERE req_code = '".$_POST['req_code201']."' and req_status= 'Feedback Available'";