Warmach Posted October 24, 2008 Share Posted October 24, 2008 Hi, I designed a roster for my clan at www.GoSoldiers.net and I am having trouble getting it to display every member beside each rank. I based the roster design on the same as a medals system i desgined and it works quite well exect displaying all the members. It only displays 1 member instead of every member with that rank. I found my problem in the database select coding and its having trouble reading from 3 databases but works fine on 2. Here is a copy of my coding - <?php /* ######################## # Skilled Soldiers Ranks # # by Reid Baughman # # http://www.GoSoldiers.net # ######################## */ ############# //-----------------------------------#Main Page Config#------------------------------------------------------ ############# require_once('../../class2.php'); require_once(HEADERF); $lan_file = e_PLUGIN."Medalsystem/language/".e_LANGUAGE.".php"; require_once(file_exists($lan_file) ? $lan_file : e_PLUGIN."Medalsystem/language/English.php"); ########## //-------------------------# Ranks #-------------------------------------------------------- ########## $title .="Skilled Soldiers Ranks & Insignia</tr>"; $sql ->db_Select("ranks", "*", "ORDER BY rank_id",""); while($row = $sql ->db_Fetch()){ $text .= " <div style='text-align:center'> <table style='width:100%' class='border' cellspacing='10' cellpadding='10'> <tr> <td style='width:15%' class='forumheader3'> <center><a href='Ranks2.php?.".$row['rank_id']."'><font color='#00FF00'>".$row['rank_name']."</font></a> <br> <br/> <a href='Ranks2.php?.".$row['rank_id']."'><img src='http://www.gosoldiers.net/SSAAHome/e107_plugins/Ranks/insignia/".$row['rank_pic']."' alt = 'Skilled Soldiers Rank'></img></a></center> </td> <td style='width:50%' class='forumheader3'> <center><a href='Ranks2.php?.".$row['rank_id']."'><font color='#FF0000'>".$row['rank_txt']."</font></a></center> </td>"; $sql2 ->db_Select("ranks_awarded", "*", "WHERE awarded_rank_id= '".$row['rank_id']."' ORDER BY awarded_id DESC",""); while($row = $sql2 ->db_Fetch()){ $sql2 ->db_Select("user", "*", "WHERE user_id = '".$row['awarded_user_id']."'",""); $row2 = $sql2 ->db_Fetch(); $text .= " <td style='width:100%' class='forumheader3'> <center><a href='".e_BASE."user.php?id.".$row['awarded_user_id']."&page=info'><font color='#00FF00'>".$row2['user_name']."</font></a> <br/> </tr>";}} $text .= " </tr> </table> </div>"; $ns -> tablerender($title, $text); require_once(FOOTERF); ?> my problem is when it reads $sql2 ->db_Select("user", "*", "WHERE user_id = '".$row['awarded_user_id']."'",""); it reads it db above it cause its also list as $sql2 but if i make it $sql3 it errors out with Fatal error: Call to a member function db_Select() on a non-object . can anyone tell help me figure out how to make it read from 3 databases and not error? Quote Link to comment https://forums.phpfreaks.com/topic/129891-solved-fatal-error-call-to-a-member-function-db_select-on-a-non-object/ Share on other sites More sharing options...
fenway Posted October 24, 2008 Share Posted October 24, 2008 Echo the sql queries. Quote Link to comment https://forums.phpfreaks.com/topic/129891-solved-fatal-error-call-to-a-member-function-db_select-on-a-non-object/#findComment-673778 Share on other sites More sharing options...
Warmach Posted October 26, 2008 Author Share Posted October 26, 2008 Took me a while to get it right but ithis is wut i did to make it work - $sql3 = new db; $sql3 ->db_Select("ranks_awarded", "*", "WHERE awarded_rank_id= '".$row4['rank_id']."' ORDER BY awarded_id DESC",""); while($row = $sql3 ->db_Fetch()){ $sql2 ->db_Select("user", "*", "WHERE user_id = '".$row['awarded_user_id']."'",""); $row2 = $sql2 ->db_Fetch(); all i had to do is add $sql3 = new db; before it and then change the sql to 3 and it displayed fine. So here it is for anyone that has the same problem or similar! Quote Link to comment https://forums.phpfreaks.com/topic/129891-solved-fatal-error-call-to-a-member-function-db_select-on-a-non-object/#findComment-675009 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.