0
내 업데이트 성명이 작동하지 않습니다. "RECORD UPDATED"를 표시하지만 테이블을 업데이트하지는 않습니다. 여기에 코드가 있습니다. 제발 도와주세요.WHILE 루프 및 배열을 사용하는 PHP 업데이트 문
<?php
$db=mysqli_connect("localhost","root","")or die("Connection error");
mysqli_select_db($db,"suhaib")or die("dbase error");
연관 배열을 생성하고 테이블을 업데이트 WHILE 루프를
<?php
if(isset($_GET['edit'])){
$sql=$db->query("SELECT * FROM forma");
while($result=mysqli_fetch_assoc($sql)){
?>
<form name="update1" action="" method="GET">
DataNumber:<input type="text" name="datanum"
value="<?php echo $result['datanumber']; ?>">
Date:<input type="text" name="date" value="<?php echo $result['date']; ?>">
Type:<input type="text" name="type" value="<?php echo $result['type']; ?>">
Subject:<input type="text" name="subject"
value="<?php echo $result['subject']; ?>">
Amount:<input type="text" name="amount"
value="<?php echo $result['amount']; ?>">
SOE:<input type="text" name="soe" value="<?php echo $result['soe']; ?>">
Note:<input type="text" name="note" value="<?php echo $result['note']; ?>">
Liquidate:<input type="text" name="liquidate"
value="<?php echo $result['liuidatedate']; ?>">
Checker Info:<input type="text" name="checkerinfo"
value="<?php echo $result['checkerinfo']; ?>">
Accounting Info:<input type="text" name="accountingconfir"
value="<?php echo $result['accountingconfir']; ?>">
<input type="submit" value="update" name="upd">
</form>
<?php }} ?>
업데이트 문을 실행. 표가 업데이트되지 않는 그러나 "RECORD 업데이트"라는 메시지를 보여줍니다
if(isset($_GET['upd'])){
$datanum=$_GET['datanum'];
$date=$_GET['date'];
$type=$_GET['type'];
$subject=$_GET['subject'];
$amount=$_GET['amount'];
$soe=$_GET['soe'];
$note=$_GET['note'];
$liquidate=$_GET['liquidate'];
$checkerinfo=$_GET['checkerinfo'];
$accounting=$_GET['accountingconfir'];
$up="UPDATE forma SET datanumber='$datanum' , date='$date' ,
type='$type' , subject='$subject' ,
amount='$amount', soe='$soe' , note='$note', liuidatedate='$liquidate' ,
checkerinfo='$checkerinfo', accountingconfir='$accounting'";
mysqli_query($db, $up);
echo "record updated";
전체 테이블 데이터 또는 특정 ID를 업데이트하십시오. – Bhargav
HTML에 올바르게 색을 지정하는 방법에 대해 질문하는' php' 태그를 추가했습니다. – ArtisticPhoenix
mysqli_query ($ db, $ up) 또는 die (mysqli_error ($ db)); ' – Barmar