我从显示表上携带'ID'并希望将其存储在名为employee_display_id的变量中。我知道,如果不创建以下功能...
if(sset($_GET['id'])){
$employee_display_id = $_GET['iod'];
}
和你继续使用“$ employee_display_id”变量,您会收到一个未定义的变量错误。
你怎么把该...
if(sset($_GET['id'])){
$employee_display_id = $_GET['iod'];
}
成...
if(isset($_POST['update']))
{
$updatename = htmlentities(strip_tags(mysql_real_escape_string($_POST['update_name'])));
$updateusername = htmlentities(strip_tags(mysql_real_escape_string($_POST['update_username'])));
echo $update_query = "UPDATE `employees` SET `name`='$updatename', `username`='$updateusername' WHERE `employee_id`='4'";/* $employee_display_id */
$update_result = mysql_query($update_query);
}
else
{
echo mysql_error();
}
这样我就可以使用该变量更新查询的WHERE子句中?
嗨Ouairz,你的推定是正确的......我从表中更新我使用的链接。我有一个isset函数用于与SELECT语句一起使用的id,并让变量i分配isset来回显。这是确认ID在我第一次打开更新页面时的传递。然后我按照你的建议改变了我的UPDATE语句。我会添加这段代码,但在添加注释时不知道如何执行此操作(newbie alert!)。所以不能让我的评论看起来像你的评论。我有一个else语句设置为“ID未设置”,这就是发生了什么。 – chrisjwebb1978