当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Error with code

问题描述:

I want to take actions using button. That is if I press edit or delete button user navigate to action.php page. Where my delete or edit query is written. I have navigated using POST method to action.php

action.php

$remove = $_REQUEST['remove'];

if(isset($_POST["remove"])) {

$sql = "DELETE FROM t_s_list WHERE `s_id` ='$remove'";

mysql_query($sql);

$NEW="This records is Deleted";

//header("location: manage_song.php?msg=$NEW");

}

Bit confused that what value is to be passed to compare it with field s_id

网友答案:

probably be an integer value corresponding to the primary key of the table, i am assuming..

网友答案:

print the $_REQUEST['remove']; and see the out put you can see the passing value

网友答案:
if (isset($_POST["remove"]))
{
 $remove = mysql_real_escape_string($_POST["remove"],$link);
 $sql = "DELETE FROM t_s_list WHERE s_id ='$remove'";
 mysql_query($sql,$link);
 $NEW="This records is Deleted";
//header("location: manage_song.php?msg=$NEW");
}
else if (isset($_POST["edit"]))
{

}
else
 echo 'Invalid Request !';
分享给朋友:
您可能感兴趣的文章:
随机阅读: