我在尝试修复我的邀请系统。当用户登录时,系统创建$_SESSION['id']
,然后脚本检查行inviteid
中是否有任何值。Mysql更新难度
如果系统检查用户是否有超过1000的点数。如果他有系统,则使用inviteid
更新引用者的点数。
<?php session_start();
ob_start();
error_reporting(0);
include("dbConn.php");
?>
<?php
if(isset($_SESSION['id'])){
?>
<?php
$unuserid = $_SESSION['id'];
$sql="select * from users WHERE id = $unuserid";
$result = mysql_query("SELECT * FROM users WHERE id='$unuserid'");
while($row = mysql_fetch_array($result))
{
$unPOINTS = $row['points'];
$uninviteid = $row['inviteid'];
}
if(isset($uninvited)) {
?>
<?php
if ($unPOINTS > 1000) {
?>
<?php
$sql="UPDATE users SET points = $unPOINTS + 500 WHERE id = $uninviteid";
$result=mysql_query($sql) or die(mysql_error()."<br />".$sql);
header("Location: index.php?page=changemember&id=$UID");
} }
?>
<?php
}
?>
那么问题是什么? – Crontab
它不更新点 – andrew
摆脱'error_reporting(0);'!不要隐藏错误信息 - 改为写干净的代码。 –