0

我正在尝试使用 MySQL 数据填充 HTML 表,但在第 128 行(即在带有 的行之后$row['location'])出现错误,显示:T_CONSTANT_ENCAPSED_STRING。我已经用谷歌搜索了,但我无法真正理解这意味着什么或我可能会出错的地方。任何帮助将不胜感激。谢谢 :)

echo "<table id='row1_border'>";
                    while($row = mysql_fetch_array($result)) ;
                    {
                    echo "<tbody>";
                        echo "<tr class='job_listing'>";
                            echo "<td class='job'>";
                                echo "<div class='company_image'></div>";

                                echo "<div class='job_title'>";
                                    echo "<span class='job_title_style'></span>";
                                echo "</div>";
                                echo "<div class='company_name'>";
                                    echo "<span class='company_name_style'>Akin, Gump, and Smith</span>";
                                echo "</div>";
                                echo "<div class='company_tagline'>";
                                    echo "<span class='company_tagline_style'>This is just a test.</span>";
                                echo "</div>";
                            echo "</td>";
                            echo "<td class='location'>";
                                echo "<div class='location_div'>";
                                    echo "<span class='location_style'>";
                                        $row['location']

                                "</span>";
                                echo "</div>";
                            echo "</td>";
                            echo "<td class='job_type'>";
                                echo "<div class='job_type_div'>";
                                    echo "<span class='job_type_style'>";

                                        echo .$row['job_type'].
                                    "</span>";
                                echo "</div>";
                            echo "</td>";
                        echo "</tr>";
                    echo "</tbody>";
                    }
                echo "</table>"

                ?>
4

4 回答 4

1

您在有问题的行之前没有回声,请尝试:

回声 $row['location'];

此行之后的行也没有正确回显。

确保你在呼应每一行。

于 2012-04-22T23:00:08.313 回答
0

这是因为你需要分号。

我建议您以后阅读该错误。

于 2012-04-22T23:17:07.740 回答
0

尝试这个

echo "<td class='location'>";
     echo "<div class='location_div'>";
         echo "<span class='location_style'>".$row['location']."</span>";                   
     echo "</div>";
 echo "</td>";
 echo "<td class='job_type'>";
     echo "<div class='job_type_div'>";
         echo "<span class='job_type_style'>".$row['job_type']."</span>";
     echo "</div>";
 echo "</td>";
于 2012-04-22T23:20:30.000 回答
0

祝你好运

<table><tbody>
<?php while($row = mysql_fetch_array($result)) { ?>
                    <tr class='job_listing'>
                        <td class='job'>
                            <div class='company_image'></div>

                            <div class='job_title'>
                                <span class='job_title_style'></span>
                            </div>
                            <div class='company_name'>
                                <span class='company_name_style'>Akin, Gump, and Smith</span>
                            </div>
                            <div class='company_tagline'>
                                <span class='company_tagline_style'>This is just a test.</span>
                            </div>
                        </td>
                        <td class='location'>
                            <div class='location_div'>
                                <span class='location_style'>
                                   <?php  echo $row['location']; ?>

                            </span>
                            </div>
                        </td>
                        <td class='job_type'>
                            <div class='job_type_div'>
                                <span class='job_type_style'>

                                    <?php  $row['job_type']; ?>
                                </span>
                            </div>
                        </td>
                    </tr>
                    <?php } ?>
                </tbody>
            </table>
于 2012-04-22T23:44:14.123 回答