开发者

PHP - looping a result set

I am going nuts over a script which I've been doing for years now...

The following script executes fine both on my local and on my live shared hosting environment.

BUT

If I add another echo during the "while" loop, the server is giving me a 500 Internal Server Error & I don't have any error_logs :( (and no, on my local it still works fine!!!!)

Any idea why? this looks crazy for me... or I'm just tired now -.-

$select = "SELECT * FROM comments ORDER BY datetime DESC";
$result = mysql_query($select);
if (mysql_num_rows($result)) {
    while ($comment = mysql_fetch_array($result)) {
    ?>
    <tr>
        <td>
            <?php echo $comm开发者_JAVA百科ent["comment_id"]; ?>
        </td>
        <td>
            <?php echo $comment["name"]; ?
        </td>
        <td>
            <?php echo $comment["datetime"]; ?>
        </td>
        <td>
            <?php echo $comment["email"]; ?>
        </td>
        <td>
        </td>
        <td>
        </td>
        <td>
        </td>
        <td>
        </td>
    </tr>
    <?
    } 

}


You are missing a > at the end of the <?php echo $comment["name"]; ? line. That's probably the issue if you cut and pasted this code from the problem script. If not - what echo are you adding that causes it to fail?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜