Sunday, 8 September 2013

IF statement displaying only 1 variable regardless of results

IF statement displaying only 1 variable regardless of results

I have a site where users can join groups and post topics related to that
group, I am having an issue where regardless of the user result, it just
shows "member" even on a test account that has no records in the database,
can someone please explain what I am doing wrong, thank you.
<?php
$id = $_GET['gid'];
$user = $_SESSION['user_id'];
$iropen = "SELECT * FROM `group_users` WHERE user_id='$user' AND
group_id='$id'";
$resultg = mysql_query($iropen);
$rows = mysql_fetch_array($resultg);
if ($rows['accepted'] = 1) {
echo 'member';
} else {
echo 'pending';
}
if ($resultg < 1) {
echo 'join';
}
?>

No comments:

Post a Comment