【问题标题】:internet explorer echoes out duplicate mysql results?Internet Explorer 回显重复的 mysql 结果?
【发布时间】:2013-01-30 23:15:10
【问题描述】:

您好,有点令人困惑,我把它归结为 mysql 查询,因为我看不出它还能是什么。基本上,我在页面顶部的网站上回显了 7 个用户。并且在除 IE 之外的所有浏览器中只显示 7 个用户。我将我的用户显示在一个带有边框和框阴影等的 div 中,我将该 div 包装在指向他们个人资料的链接中,现在在 ie 中,我得到了一个包含七个用户的列表,但在每个结果旁边(每个用户)我得到重复的结果,带有指向用户个人资料的链接,但没有图片?

我不知道这个重复的结果是从哪里来的,为什么它只发生在 ie (ALL VERSIONS)

这是我的代码,有人可以解释一下我能做什么,谢谢。

图像在 ie 中显示如下:

ni = 没有图片链接

  box1    |    box 1 (ni)    |  box 2   |   box 2 (ni)    |   box 3    |    box3 (ni)   etc

这是我的功能

function get_platinum_users() {
        global $connection;
        $query = "SELECT *
                    FROM ptb_users, ptb_profiles
                    WHERE ptb_users.account_type = \"User\"
                    AND ptb_users.account_status = \"Active\"
                    AND ptb_profiles.user_id = ptb_users.id
                    AND ptb_users.subscription = \"Platinum\"
                    LIMIT 0 , 7";
        $platinum_set = mysql_query($query, $connection);
        confirm_query($platinum_set);
        return $platinum_set;
    }

和我的 php 代码:

<?
 $platinum_set = get_platinum_users();
 $platinum_count = mysql_num_rows($platinum_set);
        while ($platinum = mysql_fetch_array($platinum_set)) {
?>

<? echo"<div class=\"image_case\"><a href=\"profile.php?id={$platinum['id']}\"><img width=80px height= 80px src=\"data/photos/{$platinum['id']}/_default.jpg\"></div>";

}

    // if there were less than 60 users we need some default profiles to fill the spaces
    if($platinum_count < 7){
        // how many default spaces do we need?
        $default_profiles_needed = 7 - $platinum_count;        
        for($i = 1; $i <= $default_profiles_needed; $i++){
            echo "<div class=\"image_case\">
                    <a href=\"default.php\">
                        <img width=80px height= 80px src=\"data/photos/0/no_add.jpg\"/>
                </div>";
        }
    }


?>     

【问题讨论】:

    标签: php mysql internet-explorer


    【解决方案1】:

    您的所有超链接都没有关闭。你错过了关闭&lt;/a&gt;s。 IE 对坏代码(甚至经常是好代码)不太宽容。

    当您遇到奇怪的错误时,请始终validate your code。它可能非常有启发性。

    【讨论】:

      【解决方案2】:

      你没有关闭你的锚标签。替换下面的行

      <? echo"<div class=\"image_case\"><a href=\"profile.php?id={$platinum['id']}\"><img   width=80px height= 80px src=\"data/photos/{$platinum['id']}/_default.jpg\"></div>";
      

      <? echo"<div class=\"image_case\"><a href=\"profile.php?id={$platinum['id']}\"><img width=80px height= 80px src=\"data/photos/{$platinum['id']}/_default.jpg\"></a></div>";
      

      【讨论】:

        猜你喜欢
        • 2010-09-13
        • 2011-02-08
        • 2013-11-28
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2015-04-26
        • 2012-03-27
        • 1970-01-01
        相关资源
        最近更新 更多