从带有页眉的PHP更新页面传递ID
我正在尝试将用户ID从“编辑配置文件”页面传递到一个页面,该页面将统计是否成功从带有页眉的PHP更新页面传递ID,php,Php,我正在尝试将用户ID从“编辑配置文件”页面传递到一个页面,该页面将统计是否成功 <?php ob_start(); ?> <?php include("includes/header.php"); ?> <?php // Connect to server and select database. include("connect.php"); // update data in mysql database $sql=
<?php ob_start(); ?>
<?php include("includes/header.php"); ?>
<?php
// Connect to server and select database.
include("connect.php");
// update data in mysql database
$sql="UPDATE apply SET email='$_POST[email]'
WHERE authentication='$_POST[authentication]'" or die ("cant find player");
$result=mysql_query($sql) or die ("this stuffedup");
// if successfully updated.
if($result){
header('location: ../updated_profile.php?authentication=$row['authentication']');
}else{
echo "Something has went wrong";
}
?>
<?php include("footer.php"); ?>
说出你的报价:
header('location: ../updated_profile.php?authentication='.$row['authentication']);
此外,请按如下方式更新查询字符串:
$sql="UPDATE apply SET email = '".$_POST[email]."' WHERE authentication='".$_POST[authentication]."'";
最后,请阅读SQL注入以及如何防止它。标题(“位置:../updated_profile.php?authentication=“.$row['authentication]”);你这么多次打开和关闭PHP标签是有原因的吗?谢谢,但我认为我的问题在于其他地方,因为当我悬停在链接上时,它没有显示id号。不是真的-我在测试页面上一次处理一个小部分,只是复制并粘贴了完整的内容。好的,按照大家的建议做了,但仍然没有传递id。从何处获取$row
变量?您从查询中实际从何处获取数据?谢谢BenM-我没有注意到我从数据库中收集信息并将它们放在$行中