我有一個頁面查詢,將設置爲0或1的表。設置爲1正在工作,但它不會設置爲0.這是代碼片段遠。任何人都可以看到有什麼不對?數據庫沒有更新的「獲取」PHP
頁:
<p><? if($_SESSION['user_level'] >= GUARDIAN_LEVEL) { if ($row_settings['profile_list'] == 0) {?>
<a onclick='$.get("dos.php",{ cmd: "sprofile", setp:$("1").val(),id: "<?php echo $row_settings['id']; ?>" } ,function(data){ $("#msgp").html(data); });' href="javascript:void(0);">List</a>
<?php } else if ($row_settings['profile_list'] == 1) {?>
<a onclick='$.get("dos.php",{ cmd: "sprofile", setp:$("0").val(),id: "<?php echo $row_settings['id']; ?>" } ,function(data){ $("#msgp").html(data); });' href="javascript:void(0);">Unlist</a>
<?php } else {echo "N/A";}} else {echo "N/A";} ?></p>
更新代碼:
if($get['cmd'] == 'sprofile')
{
mysql_query("update users set profile_list='$get[setp]' where id='$get[id]'");
echo "Profile Listing Changed";
//header("Location: $ret");
// exit();
}
編輯
更新代碼:
if($_GET['cmd'] == 'sprofile')
{
$set = mysql_real_escape_string($_GET['setp']);
$id = mysql_real_escape_string($_GET['id']);
mysql_query("update users set profile_list='" . $set . "' where id='" . $id . "'");
echo "Profile Listing Changed";
//header("Location: $ret");
// exit();
}
這將設置我t爲0並顯示正確的代碼,但由於某些原因不會回到1。
除了在GET上執行破壞性操作的**巨大**設計缺陷之外, –
@ IgnacioVazquez-Abrams請解釋一下嗎? – dpDesignz