This is the codes:
while ($row= mysqli_fetch_assoc($result)) {
//
?>
<table >
<tr>
<td>
<p><?php echo $row['groupName'];?></p>
<p><?php echo $row['groupPhoneNumber'];?></p>
</td>
</tr>
<tr>
<td>
<?php
if (isset($_POST['submit'])) {
$status=1; // 1 is equel to requesting.
$member_request=$_SESSION['id'];
$group_requested=$row['groupName'];
$select_chech= mysqli_query($con,"SELECT * FROM grouptbl WHERE groupCreator ='$member_request'");
if (mysqli_num_rows($select_chech)>0) {
$error="You are a member of this group!";
}else {
$query_request=mysqli_query($con,"INSERT INTO `tblrequest`(`member_request`, `group_requested`, `status`) VALUES ('".$_SESSION['id']."','$group_requested',1)");
$msg="now you requested to ".$row['groupName'];
}
}
?>
<form method="post">
<button type="submit" name="submit"
class="btn btn-success waves-effect waves-light">ask</button>
</form>
</td>
</tr>
</table>
<?php
}//end of while condition
see that ! on if condition statement that will help me to check if member is in the group it is not giving me an error either else not working! please help me!!