Php 按钮使一行处于活动状态,其他行处于非活动状态
此状态(活动1/非活动0)按钮使任何单个记录处于活动/非活动状态。 我需要更改它,以便在单击时通过更改TBLADDRENT_status db变量使该记录处于活动状态,而使所有其他记录处于非活动状态Php 按钮使一行处于活动状态,其他行处于非活动状态,php,sql,pdo,Php,Sql,Pdo,此状态(活动1/非活动0)按钮使任何单个记录处于活动/非活动状态。 我需要更改它,以便在单击时通过更改TBLADDRENT_status db变量使该记录处于活动状态,而使所有其他记录处于非活动状态 if (isset($_GET['tbladdress_status'])) { if ($_GET['tbladdress_status']=="ok") { $statusupdate=$db->prepare("UPDATE tbl
if (isset($_GET['tbladdress_status'])) {
if ($_GET['tbladdress_status']=="ok") {
$statusupdate=$db->prepare("UPDATE tbl_address SET
tbladdress_status=:tbladdress_status
WHERE tbladdress_id={$_GET['tbladdress_id']}
");
$update=$statusupdate->execute(array(
'tbladdress_status' => $_GET['activestatus']
));
if ($update) {
Header("Location:../../front-address-all.php?status=ok");
} else {
Header("Location:../../front-address-all.php?status=no");
}
}
}
表示,单击按钮后,您希望隐藏当前按钮并显示另一个按钮。您好,在活动地址列中,只有一行显示“活动”,其他行显示“非活动”,如果您单击另一行,则该行将处于活动状态,其他行将处于非活动状态。您可以这样做,通过使用jquery和javascript。是什么阻止您调整逻辑?另外,请注意,您的代码对SQL注入是开放的(在WHERE
子句中)Ref:SQL注入,不准备语句阻止注入?我应该在不太了解的情况下使用PDO。这意味着,单击按钮后,您希望隐藏当前按钮并显示另一个按钮。您好,在活动地址列中,只有一行显示“活动”,其他行显示“非活动”,如果您单击另一行,则该行将处于活动状态,其他行将处于非活动状态。您可以这样做,通过使用jquery和javascript。是什么阻止您调整逻辑?另外,请注意,您的代码对SQL注入是开放的(在WHERE
子句中)Ref:SQL注入,不准备语句阻止注入?我应该在不太了解的情况下使用PDO。
<?php
if ($pulladdress['tbladdress_status']==1) { ?>
<a href="nedmin/netting/pdo-process.php?tbladdress_id=<?php echo $pulladdress['tbladdress_id'] ?>&activestatus=0&tbladdress_status=ok"><button class="btn btn-success btn-xs"><?php echo _ACTIVE; ?></button>
<?php } elseif($pulladdress['tbladdress_status']==0) {?>
<a href="nedmin/netting/pdo-process.php?tbladdress_id=<?php echo $pulladdress['tbladdress_id'] ?>&activestatus=1&tbladdress_status=ok"><button class="btn btn-danger btn-xs"><?php echo _PASSIVE; ?></button>
<?php } ?>