Warmach Posted October 28, 2008 Share Posted October 28, 2008 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>";} Quote Link to comment Share on other sites More sharing options...
mrmitch Posted October 28, 2008 Share Posted October 28, 2008 $echo out your sql statements so you (we) can see the actual statement being sent to the db. Quote Link to comment Share on other sites More sharing options...
Warmach Posted October 28, 2008 Author Share Posted October 28, 2008 ok i am having trouble getting it to echo the DB, keeps erroring out! any other way you can help or do I need to work on the echo more? Quote Link to comment Share on other sites More sharing options...
Warmach Posted October 28, 2008 Author Share Posted October 28, 2008 what is the exact echo command and where should i put it? I must be doing it wrong cause its erroring out each time i try Quote Link to comment Share on other sites More sharing options...
Barand Posted October 28, 2008 Share Posted October 28, 2008 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; Quote Link to comment Share on other sites More sharing options...
Warmach Posted October 28, 2008 Author Share Posted October 28, 2008 when i add that it then shows no names or counts but doesn't error out anymore Quote Link to comment Share on other sites More sharing options...
fenway Posted October 30, 2008 Share Posted October 30, 2008 when i add that it then shows no names or counts but doesn't error out anymore No one knows what that means. Quote Link to comment Share on other sites More sharing options...
Warmach Posted October 30, 2008 Author Share Posted October 30, 2008 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 Quote Link to comment Share on other sites More sharing options...
fenway Posted October 30, 2008 Share Posted October 30, 2008 It's impossible that echo-ing a single line messes up the rest of the page. Quote Link to comment Share on other sites More sharing options...
Warmach Posted October 30, 2008 Author Share Posted October 30, 2008 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",""; Quote Link to comment Share on other sites More sharing options...
Mchl Posted October 30, 2008 Share Posted October 30, 2008 $sql = "advmedsys_awarded2", "*", "WHERE awarded_rib_id=$sub_action",""; Barand tricked you into this, without noticing it's not even a valid PHP.... What library are you using to connect to the database? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.