I have a problem with writing php code into html. Here is a sample code.
<?php
include_once 'phpFiles/session.php';
include_once 'class_db_connect.php';
$sql="select * from officeinfo where empid=$empid";
$result=mysql_query($sql);
$nrow=mysql_numrows($result);
while($row=mysql_fetch_array($result)) {
$tableoutput=<<<_
<table>
<tr >
<th align="left">Employee ID</th><td>$row[empid]</td>
</tr>
<tr>
<th align="left">Department</th><td>$row[deptname]</td>
</tr>
<tr>
<th align="left">Position Name         </th><td>$row[positionname]</td>
</tr>
<tr>
<th align="left">Salary Grade</th><td>$row[salarygradeid]</td>
</tr>
<tr>
<th align="left">Joining Date</th><td>$row[joiningdate]</td>
</tr>
$stuid=$row_record_student[id];
$query_record_student_info = sprintf("SELECT * FROM previous_qualification where student_id=$stuid");
$record_student_info = mysql_query($query_record_student_info, $M) or die(mysql_error());
$numrows=mysql_num_rows($record_student_info);
$i=1;
while($student_info=mysql_fetch_assoc($record_student_info))
{
$awardingbody_previous=stripslashes($student_info[Awarding_Body]);
$qualification=stripslashes($student_info[previous_qualification]);
$year=stripslashes($student_info[year]);
$result=stripslashes($student_info[result]);
<tr>
<td><table>
<tr>
<td valign="top">$i</td>
<td valign="top">$qualification , $awardingbody_previous, Year - $year , Result - $result</td>
</tr>
</table></td>
</tr>
$i++ }
</table>
_;
echo $tableoutput;
}
?>
in php i write html and i want to execute while loop in the html code but thats a problem , i can’t get the whole output that i want. how can i do this ?