good morning to all...
im newbie to php n mysql..
i have problem...in database under "mentor1" have 2mentees "mentee1 n mentee2"
so i want the system show the all mentee..
i have tried,but its only show mentee1 only, how to make it loop to show all mentee?
$cur_login = $_SESSION["username"];
$conn= db_connect();
$aa=0;
$query = "select mentee, username_mentee from mentormentee where username_mentor = '$cur_login'";
$result = $conn->query($query);
if($result->num_rows >0){
$row = mysqli_fetch_assoc($result);
$m_mentee= $row["mentee"];
$m_username= $row["username_mentee"];
}
-
- $cur_login = $_SESSION["username"];
- $conn= db_connect();
- $aa=0;
-
- $query = "select mentee, username_mentee from mentormentee where username_mentor = '$cur_login'";
- $result = $conn->query($query);
-
- if($result->num_rows >0){
- $row = mysqli_fetch_assoc($result);
-
- $m_mentee= $row["mentee"];
- $m_username= $row["username_mentee"];
-
- }
-
the table
<table width="567" border="0" align="center">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="109" bgcolor="#FFD9D9"><div align="center">No</div></td>
<td width="111" bgcolor="#FFD9D9">Name</td>
<td bgcolor="#FFD9D9" width="149"><div align="center">Id</div></td>
<td bgcolor="#FFD9D9" width="182"><div align="center">Major</div></td>
</tr>
<tr>
<?php
while ($row = mysqli_fetch_assoc($result)){
$aa = $aa + 1;
?>
<td><?php echo $aa; ?> </td>
<td><?php echo $m_mentee; ?> </td>
<td><?php echo $m_username; ?> </td>
<td> </td>
</tr><?php } ?>
</table>
-
- <table width="567" border="0" align="center">
- <tr>
- <td> </td>
- <td> </td>
- <td> </td>
- <td> </td>
- </tr>
- <tr>
- <td width="109" bgcolor="#FFD9D9"><div align="center">No</div></td>
- <td width="111" bgcolor="#FFD9D9">Name</td>
- <td bgcolor="#FFD9D9" width="149"><div align="center">Id</div></td>
- <td bgcolor="#FFD9D9" width="182"><div align="center">Major</div></td>
- </tr>
- <tr>
- <?php
- while ($row = mysqli_fetch_assoc($result)){
- $aa = $aa + 1;
- ?>
- <td><?php echo $aa; ?> </td>
- <td><?php echo $m_mentee; ?> </td>
- <td><?php echo $m_username; ?> </td>
- <td> </td>
- </tr><?php } ?>
- </table>
-
-