What i want to do is when semester
is equals to "1" it will print "st Semester S.Y" else if semester
is equals to "2" it will print "nd Semester S.Y". But the problem is i get an error of Parse error: syntax error, unexpected 'if' (T_IF)
. Can someone help me about this?
here's my code.
if(isset($_POST['loadsem'])){
$stud = $_POST['stud'];
$output = '';
$sql = "SELECT DISTINCT sch_year,semester FROM grades WHERE stud_no ='$stud'";
$result = mysqli_query($con,$sql);
$output .= '
<div class="table-responsive">
<table class="table table-bordered">
<tr>
<th>Semesters Attended</th>
</tr>';
while($row = mysqli_fetch_array($result))
{
$sem = $row['semester'];
$year = $row['sch_year'];
$output .= '<tr>
<td><a href="">'.
if($sem == "1"){
$row['semester']. "st Semester S.Y" .$row['sch_year']
}
else{
$row['semester']. "nd Semester S.Y" .$row['sch_year']
}
.'</a></td>
</tr>
';
}
$output .= '</table>
</div>';
echo $output;
}