Bir sayfada görüntüler veri sorunu

1 Cevap php

Ben aşağıdaki kodda bir sorun var ...

O olsaydı, beş tek bir sayfada görüntülenen tüm gerekiyordu dan davet ediyoruz, böylece görüntüler her üye için davet aşağıdaki gibi aşağıdaki kod çalışır

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 ....

Ama bu tek sayfada tüm sunmak için benim istediğim değil

Ben sorunu çözmek isterdim ve ben bir sayfa tüm aramaları görebilirsiniz

Ben sorunun sipariş kodu olduğunu düşünüyorum

Ben sorunun sipariş kodu olduğunu düşünüyorum

benim kod:

<?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">
<html xmlns="http://www.w3.org/1999/xhtml">
<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 Cevap

Farklı bir sorgu sonucu için while döngü içindeki $sql değişkeni yeniden görünüyor. Sizin ninvite sorgunun ikinci satır almak için çalıştığında, aslında members sorgudan başka bir satır talep ediyoruz. Zaten ikinci tüm satırları arasında döngüye ki verilen, sizin dış döngünün ikinci bir yineleme orada olmayacak.