IF statement not sure what I am doing wrong
Before I start I am learning PHP/Mysql, so I am trying to learn and
understand all that before I move onto mysqli and researching correct
security steps, so I am aware this code will have holes int it.
Basically I am implementing a member group system and I am trying to work
out the coding so that..
IF a member is in the group, show "group member" IF a member isn't in the
group, "join group" IF a member has already requested a join, but accepted
is still = 0(pending) show "invite pending".
Here is my code so far, it's inside an include.
<?php
$id = $_GET['gid'];
$gruser = $_SESSION['user_id'];
$group = "SELECT * FROM `disc_users` WHERE user_id='$gruser' AND
group_id='$id'";
$gres = mysql_query($group);
if ($gres == 0) { ?>
<input type="button" class="sub-button" value="Join Group">
<?
}
if ($gres == 1) { ?>
<input type="button" class="sub-button" value="Group Member">
<? } ?>
I can't figure out what I am doing wrong, it's not displaying errors, but
I am getting white space, no buttons, I even added "echo" in front of
$group and it's getting the values correctly.
Any help appreciated.
No comments:
Post a Comment