Jump to content

Mutliple copies of users?!?


Warmach

Recommended Posts

On this details page for ribbons I have it where it lists which users have earned it and how many but it is reapeating the usernames for how many they have instead of just once. any ideas? to view example page go here - http://gosoldiers.net/SSAAHome/e107_plugins/advmedsys/ribbondet.php?det.19

 

 

copy of coding -

 

$text .= "

        <br></br>

        <table style='width:50%' bgcolor='#804000' class='border' cellspacing='2' cellpadding='2'>

        <tr>

        <td style='width:75%' class='forumheader3'>Member Name</td>

        <td style='width:25%' class='forumheader3'># of Ribbons</td>

        </tr>";

     

        $sql->db_Select("advmedsys_awarded2", "*", "WHERE awarded_rib_id=$sub_action","");

        while($row = $sql->db_Fetch()){

        $sql2->db_Select("user", "*", "WHERE user_id = '".$row['awarded_user_id']."'","");

        $row2 = $sql2->db_Fetch();

 

        $sql3 = new db;

        $a = 0;

        $sql3 -> db_Select("advmedsys_awarded2", "*", "WHERE awarded_rib_id=$sub_action AND awarded_user_id='".$row['awarded_user_id']."'", "");

while($row3 = $sql3->db_Fetch())

        {$a++;}

 

$text .= "

        <tr>

        <td style='width:75%' class='forumheader3'><center><font color='#00FF00'>".$row2['user_name']."</td>

        <td style='width:25%' class='forumheader3'><font color='#FFFF00'>x".$a."</td></center></td>

        </tr>";}

Link to comment
https://forums.phpfreaks.com/topic/130455-mutliple-copies-of-users/
Share on other sites

TIP:

 

Put queries into a string variable before calling the query. That way you can examine the query that is being submitted if you encounter problems, as now.

 

$sql = "advmedsys_awarded2", "*", "WHERE awarded_rib_id=$sub_action","";
$sql->db_Select($sql);

 

Now you just need to

echo $sql;

I added the echo command like was posted above. But when I did it removed everything from the page instead of showing the DB statement. I had to rewrite the coding back to the way it was to get the page to display again but I still have the same problem of it listing the names multiple times.

 

http://gosoldiers.net/SSAAHome/e107_plugins/advmedsys/ribbondet.php?det.19

ok I tried adding the echo command again and this time I have an error

 

Parse error: syntax error, unexpected ',' in /home/gosoldie/public_html/SSAAHome/e107_plugins/advmedsys/ribbondet.php on line 74

 

 

line 74 =

 

$sql = "advmedsys_awarded2", "*", "WHERE awarded_rib_id=$sub_action","";

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.