Im new to php and mysql and doing my final year project, i want to ask u ppl that what if i want to display a row of a table after some if condition, i want to diplay offered courses to all the students and if the student whose course is accepted i dont want to display <th>action</th> in that row.. iam wondering how would i do that, please help me solve the problem, thanks in advance
<?php
$con=mysql_connect($dbserver,$dbusername,$dbpassword);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($dbname, $con);
$result = mysql_query("SELECT courses.id AS cid, courses.title, courses.subjectsid, subjects.id AS sid, subjects.subjectname, requestrecord.status
FROM courses JOIN subjects ON courses.subjectsid = subjects.id
LEFT JOIN requestrecord
ON courses.id = requestrecord.coursesid AND requestrecord.accountsid=".$_SESSION['id']);
echo "<table border='1' style='width:500px;'> <br />
<tr>
<th>Course Name</th>
<th>Subject </th>
<th>Action</th>
<th>Status</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['title'] . "</td>";
echo "<td>" . $row['subjectname'] . "</td>";
echo "<td><a href='request-for-approval.php?id=".$row['cid']."& sid=".$row['sid']."'>Apply!</a></td>";
echo "<td>" . $row['status'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>