Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/237.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在PHP标记中写入HTML时出现意外语法错误“}”_Php_Html - Fatal编程技术网

在PHP标记中写入HTML时出现意外语法错误“}”

在PHP标记中写入HTML时出现意外语法错误“}”,php,html,Php,Html,我试图在PHP文件中编写HTML代码,但出现语法错误: 意外“}” 我不知道我是否错过了什么 这是我的密码: $html = ' <p><strong>About:</strong><br> '.$about.' </p> <strong>Education:</strong><br> <table> <tr> <t

我试图在PHP文件中编写HTML代码,但出现语法错误:

意外“}”

我不知道我是否错过了什么

这是我的密码:

$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>
';

此代码错误太大,无法解释此错误的原因。一个应该有效的例子:

$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>';

尝试使用诸如NetBeans或之类的IDE,它会在您键入时突出显示语法错误。

您在“{”..之后缺少“.”就在打开while循环之后…并且您不能像那样对字符串进行压缩。解释并不是太错。总是可以解释的。另外,这是一个重复的问题。谢谢,这解决了我的问题