John James
John James

Reputation: 31

internet explorer echoes out duplicate mysql results?

Hi bit of a confusing one, i put it down to the mysql query because i dont see what else it could be. basically i echo out 7 users on my site at the top of the page. and in all browsers except IE only 7 users are displayed. im dispalying my users in a div with a border and box shadow etc, and i wrap that div in a link to their profile, now in ie i get a list of seven users come up but next to each result (each user) im getting a duplicated result with the link to the users profile but no image?

I dont know where this duplicate result has come from and why it only happens in ie (ALL VERSIONS)

heres my code can someone please explain what i can do thanks.

the images are displaying like so in ie:

ni = no image only link

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

heres my function

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;
    }

and my php code:

<?
 $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>";
        }
    }


?>     

Upvotes: 0

Views: 61

Answers (2)

vancouverwill
vancouverwill

Reputation: 127

you are not closing your anchor tags. replace the line below

<? 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>";

with

<? 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>";

Upvotes: 0

John Conde
John Conde

Reputation: 219804

All of your hyperlinks are not closed. You're missing your closing </a>s. IE is not very forgiving of bad code (or even good code quite often).

Always validate your code when you get odd errors. It can be very enlightening.

Upvotes: 1

Related Questions