Ok, I'm writing a script that will allow starcraft clans to easily set up a clan and manage it without needing to know a lot about html/php, but I'm running into a slight snag with the promotion function...
function promoteMember($promotee, $reason, $ip)
{
global $fontString, $myrow, $today2, $today;
$result = @mysql_query("SELECT * FROM members WHERE username = \"$promotee\"");
$theirrow = mysql_fetch_array($result);
$rank1 = getRankByNum($myrow["rank"]);
if($myrow["rank"] > ($theirrow["rank"] + 2)) {
if($theirrow[$lastpromo] = '$today') {
echo("
<center>$fontString
<META HTTP-EQUIV=\"Refresh\" CONTENT=\"4; URL=main.php\">
$promotee was already promoted today. You can't promote a member twice in one day, please wait until tomorrow. Please hang tight, I'm forwarding you back to your login menu.
");
}
else{
$newrank = $theirrow["rank"] + 1;
$rank = getRankByNum($newrank);
$sql = "UPDATE members SET rank = \"$newrank\", lastpromo = \"$today\" WHERE username = \"$promotee\"";
@mysql_query($sql);
@mysql_query("
INSERT INTO log SET info = \"$rank1 $myrow[username] promoted $promotee to $rank for $reason on $today2.\",
ip = \"$ip\"
");
echo("
<center>$fontString
<META HTTP-EQUIV=\"Refresh\" CONTENT=\"3; URL=main.php\">
$promotee was promoted to $rank. Please hang tight, I'm forwarding you back to your login menu.
");
}
}
}
the problem lies when $theirrow[lastpromo] is null. It's telling me each time that the member has already been promoted today, but they HAVEN'T been promoted at all...
Ideas? Should be easy, I'm just stuck on it...