Warning: Cannot modify header information - headers already sent by (output started at /home/apexwyxa/public_html/click4jalandhar.in/u-banner.php:14) in /home/apexwyxa/public_html/click4jalandhar.in/conn.php on line 115
上面是我的错误,下面是我的 PHP 代码
function update_name($fname, $lname, $u)
{
include "db.php";
$query = "update users set firstname='$fname', lastname='$lname' where user_ID='$u'";
$result = mysql_query($query);
if($result)
{
$msg = "Name updated";
}
else
{
$msg = "Error => ".mysql_error();
}
header("location:userinfo.php?x=$msg");
}
function update_uname($username, $u)
{
include "db.php";
$query = "update users set username='$username' where user_ID='$u'";
$result = mysql_query($query);
if($result)
{
$msg2 = "Username updated";
}
else
{
$msg2 = "Error => ".mysql_error();
}
header("location:userinfo.php?x=$msg2");
}
function update_email($email, $u)
{
include "db.php";
$query = "update users set email='$email' where user_ID='$u'";
$result = mysql_query($query);
if($result)
{
$msg3 = "Email updated";
}
else
{
$msg3 = "Error => ".mysql_error();
}
header("location:userinfo.php?x=$msg3");
}
function update_pass($old_pass, $new_pass, $u)
{
include "db.php";
$xquery = "select * from users where user_ID = '$u'";
$xresult = mysql_query($xquery);
$xnum = mysql_num_rows($xresult);
if($xnum>0)
{
while($xrow = mysql_fetch_array($xresult))
{
extract($xrow);
if($xrow[8]!=$old_pass)
{
$msg4 = "Your current password is not correct/matching";
header("location:userinfo.php?x=$msg4");
}
else
{
$query = "update users set password='$new_pass' where user_ID='$u' and password='$old_pass'";
$result = mysql_query($query);
if($result)
{
$msg4 = "Password updated";
}
else
{
$msg4 = "Error => ".mysql_error();
}
header("location:userinfo.php?x=$msg4");
}
}
}
}