|
在更新数据库时失败,而唯有readme这个字段可以更新。小女不才,百思不得起解。今日在此留下该程序段,肯请各位大虾前来指正。多谢了!(php&mysql)
[code:1]
<?
include "config.inc.php";
include "func.php";
$title="修改用户资料";
include "require.php";
include "header.inc.php";
// 读用户资料
function ReadUserAttr00() {
global $USER_TABLE;
global $userid,$sex,$idnumber,$email,$city,$face,$work,$icq,$homepage,$photo,$readme;
$SQL="SELECT * FROM $USER_TABLE WHERE userid='$userid'";
$result=mysql_query($SQL) or die(mysql_error());
$row=mysql_fetch_Array($result);
$sex=$row[sex];
$idnumber=$row[idnumber];
$email=$row[email];
$city=$row[city];
$face=$row[face];
$icq=$row[icq];
$homepage=$row[homepage];
$photo=$row[photo];
$readme=$row[readme];
}
// 修改用户昵称
function UpdateUserNickname() {
global $ONLINE_TABLE;
global $id,$userid,$sex,$email,$face,$icq,$homepage,$city;
$SQL="UPDATE $ONLINE_TABLE SET sex='$sex',email='$email',homepage='$homepage',icq='$icq',city='$city',face='$face' WHERE id='$id'";
mysql_query($SQL) or die(mysql_error());
}
// 修改用户资料
function UpdateUserAttr0() {
global $USER_TABLE;
global $userid,$sex,$idnumber,$email,$city,$face,$icq,$homepage,$readme;
echo $userid;
echo $homepage;
echo $readme;
$SQL="UPDATE $USER_TABLE SET sex='$sex',idnumber='$idnumber',email='$email',city='$city', face='$face',icq='$icq', homepage='$homepage',readme='$readme' WHERE userid='$userid'";
mysql_query($SQL) or die(mysql_error());
}
ReadUser();
CheckDemo();
if (isset($ok)) {
echo $homepage;
UpdateUserNickname();
UpdateUserAttr0();
include "header.inc.php";
echo"<meta HTTP-EQUIV=REFRESH CONTENT=3;URL=default.php?id=$id>
</head><br><br><br><br><br><center>您的信息已成功发出! <br><br>
『<a href=default.php?id=$id>返回</a>』
<br><br><b>3秒钟后自动返回......</b><br><br>";
exit;
} else {
ReadUserAttr00();
}
?>
<FORM METHOD="POST" ACTION="<? echo $PHP_SELF; ?>" >
<TABLE width=90% border=1 align=center cellpadding="3" cellspacing="0" bgcolor="007CD0" bordercolorlight="#008000" bordercolordark="#FFFFFF">
<TR class=wdBlue>
<TD height=25 align=center colspan="2"><FONT color=FFFFFF><? echo $title; ?></FONT></TD>
<TR>
<TD height=1 bgcolor=#E3E3E3></TD>
</TR>
<TR class=wdBlack bgcolor="F8F8F8">
<TD height=30 width=18% align=center> 用 户 ID: </TD>
<TD height=30 width=82%>
<FONT color=red><? echo $userid; ?>*</FONT>
</TD>
</TR>
<TR class=wdBlack bgcolor="F8F8F8">
<TD height=30 width=18% align=center> 性 别:</TD>
<TD height=30 width=82%>
<INPUT type=radio name=sex value=0 <? echo ($sex==0) ? "checked" : ""; ?>> 男
<INPUT type=radio name=sex value=1 <? echo ($sex==1) ? "checked" : ""; ?>> 女
</TD>
</TR>
<TR class=wdBlack bgcolor="F8F8F8">
<TD height=30 width=18% align=center> E - Mail:</TD>
<TD height=30 width=82%>
<INPUT type=text name=email maxlength=40 value="<? echo $email;?>" class=wdBlack>
<FONT color=red>*</FONT> ( 此邮件地址用于转信、及忘记密码提醒 )
</TD>
</TR>
<TR bgcolor="F8F8F8">
<TD width=18% align=center > 个人主页:</TD>
<TD width=82% >
<INPUT type=text name=homepage value="<? echo $homepage; ?>" class=wdBlack>
&nbsp; &nbsp; &nbsp;OICQ:
<INPUT type=text name=icq value="<? echo $icq; ?>" class=wdBlack>
</TD>
</TR>
<TR bgcolor="F8F8F8">
<TD width=18% align=center >
所在省份:</TD><TD width="82%"><select name=city class=wdBlack value="<? echo $city;?>">
<OPTION value="0">请选择</OPTION>
<OPTION value="1"<? echo (@$city==1) ? " selected" : ""; ?>>北京</OPTION>
<OPTION value="2"<? echo (@$city==2) ? " selected" : ""; ?>>上海</OPTION>
<OPTION value="3"<? echo (@$city==3) ? " selected" : ""; ?>>新疆</OPTION>
<OPTION value="4"<? echo (@$city==4) ? " selected" : ""; ?>>辽宁</OPTION>
<OPTION value="5"<? echo (@$city==5) ? " selected" : ""; ?>>广西</OPTION>
<OPTION value="6"<? echo (@$city==6) ? " selected" : ""; ?>>海南</OPTION>
<OPTION value="7"<? echo (@$city==7) ? " selected" : ""; ?>>湖南</OPTION>
<OPTION value="8"<? echo (@$city==8) ? " selected" : ""; ?>>甘肃</OPTION>
<OPTION value="9"<? echo (@$city==9) ? " selected" : ""; ?>>河北</OPTION>
<OPTION value="10"<? echo (@$city==10) ? " selected" : ""; ?>>湖北</OPTION>
<OPTION value="11"<? echo (@$city==11) ? " selected" : ""; ?>>江苏</OPTION>
<OPTION value="12"<? echo (@$city==12) ? " selected" : ""; ?>>江西</OPTION>
<OPTION value="13"<? echo (@$city==13) ? " selected" : ""; ?>>西藏</OPTION>
<OPTION value="14"<? echo (@$city==14) ? " selected" : ""; ?>>山东</OPTION>
<OPTION value="15"<? echo (@$city==15) ? " selected" : ""; ?>>浙江</OPTION>
<OPTION value="16"<? echo (@$city==16) ? " selected" : ""; ?>>福建</OPTION>
<OPTION value="17"<? echo (@$city==17) ? " selected" : ""; ?>>安徽</OPTION>
<OPTION value="18"<? echo (@$city==18) ? " selected" : ""; ?>>吉林</OPTION>
<OPTION value="19"<? echo (@$city==19) ? " selected" : ""; ?>>山西</OPTION>
<OPTION value="20"<? echo (@$city==20) ? " selected" : ""; ?>>云南</OPTION>
<OPTION value="21"<? echo (@$city==21) ? " selected" : ""; ?>>四川</OPTION>
<OPTION value="22"<? echo (@$city==22) ? " selected" : ""; ?>>贵州</OPTION>
<OPTION value="23"<? echo (@$city==23) ? " selected" : ""; ?>>重庆</OPTION>
<OPTION value="24"<? echo (@$city==24) ? " selected" : ""; ?>>陕西</OPTION>
<OPTION value="25"<? echo (@$city==25) ? " selected" : ""; ?>>内蒙古</OPTION>
<OPTION value="26"<? echo (@$city==26) ? " selected" : ""; ?>>天津</OPTION>
<OPTION value="27"<? echo (@$city==27) ? " selected" : ""; ?>>河南</OPTION>
<OPTION value="28"<? echo (@$city==28) ? " selected" : ""; ?>>青海</OPTION>
<OPTION value="29"<? echo (@$city==29) ? " selected" : ""; ?>>黑龙江</OPTION>
<OPTION value="30"<? echo (@$city==30) ? " selected" : ""; ?>>宁夏</OPTION>
<OPTION value="31"<? echo (@$city==31) ? " selected" : ""; ?>>台湾</OPTION>
<OPTION value="32"<? echo (@$city==32) ? " selected" : ""; ?>>香港</OPTION>
<OPTION value="33"<? echo (@$city==33) ? " selected" : ""; ?>>澳门</OPTION>
<OPTION value="34"<? echo (@$city==34) ? " selected" : ""; ?>>广东</OPTION>
<OPTION value="35"<? echo (@$city==35) ? " selected" : ""; ?>>其他</OPTION>
</select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;我的照片: [ <A href="<? echo "photo.php?id=$id"; ?>">上传照片</A> ]
</TD>
</TR>
<TR>
<TD width=18% align=center bgcolor=F8F8F8>自我介绍:</TD>
<TD width=82% bgcolor=F8F8F8>
<TEXTAREA name=readme rows=10 cols=50 wrap=physical class=wdBlack><? echo $readme; ?></TEXTAREA>
</TD>
</TR>
<TR bgcolor="F0F0F0"><TD align=center width=18%>选择您的头像: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TD>
&nbsp;&nbsp;&nbsp;&nbsp;<TD bgcolor="F0F0F0" width=82%><img src="images/face/0.gif" >
<SELECT NAME="face" class=wdBlack>
<OPTION value="0">请选择</OPTION>
<?
for ($i=0;$i<=128;$i++) {
echo " <OPTION value=\"$i\"";
echo ($face=="$i") ? " selected" : "";
echo ">$i</OPTION>\n";
}
?>
</SELECT>
&nbsp;&nbsp;&nbsp;&nbsp;<a href="images/face/index.html" target=_blank>查看所有的头像列表</a></TD>
</TR>
<TR >
<TD colspan=4 align=center>
<INPUT type=submit name="ok" value=" 发送 " class=wdBlack>
<INPUT type=hidden name="id" value="<? echo $id; ?>">
</TD>
</TR>
</TABLE>
</FORM>
<HR color=#E3E3E3 noshade width=100% size=1>
<DIV class=wdBlack align=center><? echo $COPYRIGHT; ?></DIV>
[/code:1] |
|