我正在尝试将用户的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="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"); ?>
答案 0 :(得分:1)
打破你的报价:
header('location: ../updated_profile.php?authentication='.$row['authentication']);
此外,更新您的查询字符串,如下所示:
$sql="UPDATE apply SET email = '".$_POST[email]."' WHERE authentication='".$_POST[authentication]."'";
最后,请阅读SQL注入,以及如何防止它。