tags:

views:

35

answers:

1

hi ,,,,,

I have a problem in the following code ...

The following code works as follows displays the invites for each member so that if he had five invite from supposed to be displayed all on one page

But before you code that does not function Proper image is the only display one invite on the page and until the approval or rejection of the invitation displays the invite the other ....

But this is not my want to offer all on one page

I wish I could solve the problem and I can view all calls in one page

I think that the problem is in the order code

I think that the problem is in the order code

my code :

<?php  
session_start(); 

if (!isset($_SESSION['user_id'])) 
{ 
header("Location: login.php"); 
}

$id=$_SESSION['user_id'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<center>

   <?php 

   include("connect.php");
   $sql =mysql_query("select * from ninvite where recieverMemberID ='$id' and viwed= '0'");

   $num =mysql_num_rows($sql);
   echo     $num ;

   if ($num>0)
   {
   while($row=mysql_fetch_array($sql))
   {
    $sender=$row['SenderMemberID'];

     $room=$row['RoomID'];



    $sql =mysql_query("select MemberName from members where MemberID ='$sender'  ");
    $sql1 =mysql_query("select RoomName from rooms where RoomID ='$room' ");
    while($row=mysql_fetch_array($sql))

       {$mem =$row['MemberName'];

     }

     while($rows=mysql_fetch_array($sql1))

       {   $Ro =$rows['RoomName'];


    ?>
       <form action="join.php" method="post">
   <label> 
   </label> <br/>
    <label> <?php echo "  you have invite from $mem to join $Ro"; ?> </label>   
    <br/><br/>
     <label>accept</label>
    <input name="radio1" type="radio" value="accpet"  />
     <label>reject</label>
    <input name="radio1" type="radio" value="Reject"  /><br/>
  <input  type="submit" name="submit" value="done" />

     </form>
<?php } }  } ?>

</center>
</body>
</html>

thanks alot.

+1  A: 

You seem to be reusing the $sql variable inside your while loop for the result of a different query. When it tries to get the second row of your ninvite query, you're actually requesting another row from the members query. Given that you've already looped through all the rows of the latter, there will never be a second iteration of your outer loop.

eswald
thanks too much ,,,, the problem is solved