I am trying to write HTML code within a PHP file and getting the syntax error:
unexpected '}'
I don't know I missed something or not.
Here is my code:
$html = '
<p><strong>About:</strong><br>
'.$about.'
</p>
<strong>Education:</strong><br>
<table>
<tr>
<th>Degree</th>
<th>Institute</th>
<th>Start Year</th>
<th>End Year</th>
</tr>
'.$querySkills="select * from skills where user_id = $userId";
$runSkills=mysqli_query($db,$querySkills);
while ($row = mysqli_fetch_array($runSkills)) {
'<tr>
<td>'.$row["degree_title"].'</td>
<td>'.$row["institute"].'</td>
<td>'.$row["startyear"].'</td>
<td>'.$row["endyear"].'</td>
</tr>
'.}.'
</table>
';
答案 0 :(得分:-1)
This code is too wrong to explain why this is wrong. An example that should work:
$html = '
<p><strong>About:</strong><br>'.$about.'</p>
<strong>Education:</strong><br>
<table>
<tr>
<th>Degree</th>
<th>Institute</th>
<th>Start Year</th>
<th>End Year</th>
</tr>
';
$querySkills = "select * from skills where user_id = $userId";
$runSkills=mysqli_query($db,$querySkills);
while ($row = mysqli_fetch_array($runSkills)) {
$html .= '<tr>
<td>'.$row["degree_title"].'</td>
<td>'.$row["institute"].'</td>
<td>'.$row["startyear"].'</td>
<td>'.$row["endyear"].'</td>
</tr>
';
}
$html .= '</table>';
Try using an IDE such as NetBeans or PhpStorm, which will highlight syntax errors while you're typing.