嗨,我似乎無法弄清楚這一點。我有一個表,我想在這裏補充刪除功能是我的代碼href不工作我的回聲php
<?php
$delete = "delete";
$user = $_SESSION['hlbank_user']['user_id'];
$sql = "SELECT * FROM tbl_complains where user_id='".$user."' ORDER BY create_date asc ";
$result = dbQuery($sql);
while($row = dbFetchAssoc($result)){
if($row['eng_id']==0){
$engid= 'N/A';
}else{
$sqls = "SELECT * FROM tbl_engineer where eid='".$row['eng_id']."'";
$results = dbQuery($sqls);
$rows = dbFetchAssoc($results);
$engid= $rows['ename'];
}
echo '<tr class="row1" style="height:25px;">
<td align="center">'.$row['acc_no'].'</td>
<td align="center">'.$row['comp_name'].'</td>
<td align="center">'.$row['comp_desc'].'</td>
<td align="center">'.$row['status'].'</td>
<td align="center">'.'<a href='delete.php?id=".$row['user_id']."'>'.'Delete'.'</a>'.'</td>';
//The problem is in this line. When ever i try putting a href the whole table will not show.
echo '</tr>';
}
?>
,這裏是我的delete.php
<?php
if(isset($_GET['user_id'])) {
$id = $_GET['user_id'];
$con = new mysqli('localhost', 'root', '', 'db_hlbank');
$sql = 'DELETE FROM tbl_complains WHERE user_id = ?';
$delete = $con->prepare($sql);
$delete->bind_param('i', $id);
$delete->execute();
if($delete->affected_rows > 0) {
header('Location: index.php');
}
}
?>
另一個問題: 是否有這個不調用刪除整合的方式。 PHP的?
非常感謝!
問題在報價中。 –
'
嗨SIr @anant!感謝您的評論,所有的東西都能正常工作! –