2010-06-03, 10:07 PM
First of all, this has nothing to do with MyBB, that's why it's in the Chit-Chat section.
Now, I'm working on a messaging system and I'm having issues with archiving messages.
Basically, when a user clicks "archive" on a message in their inbox, it uses a function to change the db setting for that message to show that it's been archived.
Then, when the user clicks "renew" on a message in their archive, it will essentially reverse the former process.
The links use $_GET to pass the information needed for this:
My problem is that no matter what $do equals, the latter "If" statement is executed.
Here are the functions called above:
I'm sure it's something small that I'm just not catching so I'd appreciate some extra eyes.
Now, I'm working on a messaging system and I'm having issues with archiving messages.
Basically, when a user clicks "archive" on a message in their inbox, it uses a function to change the db setting for that message to show that it's been archived.
Then, when the user clicks "renew" on a message in their archive, it will essentially reverse the former process.
The links use $_GET to pass the information needed for this:
<?php
if(isset($_GET['do']))
$do = $_GET['do'];
if(isset($_GET['mid']))
$mid = $_GET['mid'];
if($do = 'archive' and $mid != null) {
archiveMessage($mid);
header('Location: msg.php?success=archive');
}
if($do = 'renew' and $mid != null) {
renewMessage($mid);
header('Location: msg.php?act=archive&success=renew');
}
?>
My problem is that no matter what $do equals, the latter "If" statement is executed.
Here are the functions called above:
function archiveMessage($mid) {
$mid = $mid;
$sql = "UPDATE messages SET archived='1' WHERE mid='$mid'";
mysql_query($sql);
}
function renewMessage($mid) {
$mid = $mid;
$sql = "UPDATE messages SET archived='0' WHERE mid='$mid'";
mysql_query($sql);
}
I'm sure it's something small that I'm just not catching so I'd appreciate some extra eyes.