Code: Select all
<?php
$dl = mysql_connect ("localhost","nitin_nick","test1234");
$db = mysql_select_db("nitin_registration",$dl);
echo "<table border='0' width='986' align='center' cellspacing='1' cellpadding='5'>";
echo "<tr>";
echo "<th>Team Name</th>";
echo "<th>Team Contact</th>";
echo "<th>Member Name</th>";
echo "<th>Member Email</th>";
echo "<th>Mobile Phone</th>";
echo "<th>College</th>";
echo "</tr>";
$result1="";
$result2="";
$query1 = "SELECT * FROM team ";
$q1_set = mysql_query($query1,$dl);
while ($result1 = mysql_fetch_array($q1_set)) {
$team_id = $result1['id'];
echo "<tr>";
echo "<td>".$result1['name']."</td>";
echo "<td>".$result1['contact']."</td>";
echo "<td>".""."</td>";
echo "<td>".""."</td>";
echo "<td>".""."</td>";
echo "<td>".""."</td>";
echo "</tr>";
$query2 = "SELECT * FROM member WHERE team_id={$team_id} LIMIT 3";
$q2_set = mysql_query($query2,$dl) ;
$result2 = mysql_fetch_array($q2_set);
$count=0;
while ($result2 && $count<3) { //The index of $result2 is not incrementing
echo "<tr>";
echo "<td>".""."</td>";
echo "<td>".""."</td>";
echo "<td>".$result2['name']."</td>";
echo "<td>".$result2['email']."</td>";
echo "<td>".$result2['phone']."</td>";
echo "<td>".$result2['college']."</td>";
echo "</tr>";
$count++ ;
}
}
echo "</table>";
?>