Jump to content

InterDevelop

Members
  • Posts

    13
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://InterDevelop.com

Profile Information

  • Gender
    Not Telling
  • Location
    Greenville, SC

InterDevelop's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. ??? I'm not sure either.... The sorting works for the [code] ORDER BY MemberTypeID ASC [/code] segment, but the other part just isn't catching... I'm going to take a further look at the actual data in the tables and see if I'm still missing something. Thank you for taking some time with me on this. If I find out anything new, I'll post back to here. Thank you - Jeff
  2. :-\ Those particular ranking were specific to that set of IDs. There are other member IDs in the system that may have a ranking as high as 30.
  3. The first set of results --- [code] WHERE   mem.MemberID IN (48, 64, 66, 84, 100, 169, 173, 181, 277, 287, 545, 546, 562,   579, 592, 599, 600, 616, 642, 663, 667, 675, 698, 743) [/code] are a list of MemberIds that match a set of criteria from from a locations (i.e. city code match) table and a services provided table. I use these IDs to retreive the members data out of the membership table (ASIDMembers). Part of the process is displaying the order by how the member ranked a certain service in the services table (ResServicesProvided). To simplify (hopefully)... [list] [*]I have a set of results (1 or more member IDs). [*]I retreive the details from the members table. [*]I need to sort these results by a ranked number (possibly values of 1-30 - res.ResRanked) from the services provided table. [/list] The IDs are correct, but the ranking of these IDs is where I get stuck. Hopefully this clarifies a little.  ???
  4. This is the full query that is passed based on selection criteria: [code] SELECT   mem.MemberID, mem.FirstName, mem.MiddleName, mem.LastName, mem.CompanyName,   mem.MemberTypeID, mem.MemberLevel, mem.Addr1, mem.Addr2, mem.City, mem.State,   mem.Zip, mem.Work, mem.Fax, mem.Email, res.MemberID, res.ResRanked FROM   ASIDMembers AS mem   LEFT JOIN ResServicesProvided AS res ON (res.MemberID=mem.MemberID) WHERE   mem.MemberID IN (48, 64, 66, 84, 100, 169, 173, 181, 277, 287, 545, 546, 562,   579, 592, 599, 600, 616, 642, 663, 667, 675, 698, 743) GROUP BY   mem.MemberID ORDER BY   res.ResRanked ASC, mem.MemberTypeID ASC [/code] The res.ResRanked column (res.MemberID = res.ResRanked) results are: 48=1 64=1 84=1 100=1 181=1 545=1 579=1 592=1 600=1 663=1 667=1 675=1 698=1 66=2 169=2 173=2 277=2 287=2 616=2 642=2 743=2 546=3 562=4 599=4 So all the res.MemberIDs that = 1 (i.e. res.ResRanked =  1) should show up first and then 2, then 3, then 4... Hoever, the ordering of the results is as followis: 675, 698, 546, 579, 277, 545, 592, 667, 599, 562, 181, 287, 100, 600, 64, 84, 48, 642, 616, 663, 169, 66, 173, 743 So... I'm not sure why it is not ordering by res.ResRanked...??
  5. o.k.... by using a GROUP BY on the mem.MemberID field, I only get one member returning with the result set... the problem now is that the ORDER BY res.ResRanked field isn't ordering at all. The res.ResRanked field is a TINYINT. Is there an issue sorting by this type of field?... should I change the field type to a text (VARCHAR or TEXT) field type? Should I use letters instead of numbers for these fields if I want to sort by them?
  6. hmmm.  I chose to use DISTINCT because if I don't, the results repeat 44 times from the above the following query: [code] SELECT DISTINCT mem.MemberID, mem.FirstName, mem.MiddleName, mem.LastName, mem.CompanyName, mem.MemberTypeID, mem.MemberLevel, mem.Addr1, mem.Addr2, mem.City, mem.State, mem.Zip, mem.Work, mem.Fax, mem.Email, res.MemberID, res.ResRanked FROM   ASIDMembers AS mem   LEFT JOIN ResServicesProvided AS res ON (res.MemberID=mem.MemberID) WHERE   mem.MemberID IN ($members_by_location3) ORDER BY   res.ResRanked, mem.MemberTypeID [/code] I've included the res.MemberID and res.ResRanked in my column list. It seams to pull a better set of results. There still some weird things happening. :o The first issue is that this returns the same results 44 times, even though the list of MemberIDs in the WHERE memMemberID IN ($members_by_location3) statement only is in there once. Any thoughts?
  7. I think I'm almost there..... sort of... My final sql statement: [code] $sql = "SELECT DISTINCT mem.MemberID, mem.FirstName, mem.MiddleName, mem.LastName, mem.CompanyName, mem.MemberTypeID, mem.MemberLevel, mem.Addr1, mem.Addr2, mem.City, mem.State, mem.Zip, mem.Work, mem.Fax, mem.Email FROM ASIDMembers AS mem LEFT JOIN ResServicesProvided AS res ON (res.MemberID=mem.MemberID) WHERE mem.MemberID IN ($members_by_location3) ORDER BY res.ResRanked"; [/code] [list] [*]$members_by_location3 is an array of members passed from a location table earlier on in the search... (1, 201, 144, 509). This limits the results to the correct people, but the ORDER BY element does not order proplery. [*]The res.ResRanked field is a numeric value that theoretically should sort by numbers 1-50. [/list] I do get results, but the ordering still doesn't quite sort it by Rank. is there another way to do this...? ::)
  8. [!--quoteo(post=375516:date=May 20 2006, 11:36 AM:name=fenway)--][div class=\'quotetop\']QUOTE(fenway @ May 20 2006, 11:36 AM) [snapback]375516[/snapback][/div][div class=\'quotemain\'][!--quotec--] How are these tables linked? [/quote] Linked by MemberID in both tables. I think my problem is that I have several ServiceIDs & several MemberIDs that I'm trying to process. I call the [b]Services[/b] table to match a search query of up to 72 items selected. This give me the list of MemberID to pull from the [b]Members[/b] table. However, in the [b]Services[/b] table, I have a seperate field to do a rank (ORDER BY). The ranking is not in the [b]Members[/b] table, so I need to get the member details from the [b]Members[/b] table but ORDER BY the "ranking" field in the [b]Service[/b] table. Hopefully this clarifies it.
  9. I have query that gives me the perfect set of results I'm looking for. It's narrowed things down from a location table and a services provided table. I use the results (i.e. Member IDs) to pull contact info out of the membership table. However, I need to sort by a ranking number of 1 or more services provided. I'm stumped on how to do an ORDER BY from a field in another table. Has anyone worked with something like this? I've tried the following, but it doesn't work: [code]    $sql = "SELECT * FROM Members WHERE MemberID = 552 || MemberID = 562 ORDER BY ServiceProvided.Ranking";[/code] My code is amaturish at best, but trying to get some input that would help me become a better MySQL/PHP developer. :blink: Thanks, Jeff [img src=\"style_emoticons/[#EMO_DIR#]/huh.gif\" style=\"vertical-align:middle\" emoid=\":huh:\" border=\"0\" alt=\"huh.gif\" /]
  10. Ken, Thanks for the info. That worked perfectly. In the future, I'm thinking of using an MySQL database to build the array. Would I use the same code or is there something else I need to do to pull the various elements out of a MySQL contact table The reason I ask, is that here's another chunk of code someone developed for me: [code] $sql = "SELECT * FROM $Table WHERE MemberID = $MemberID"; $result = mysql_query($sql, $conn); if ($result && (mysql_num_rows($result) > 0)) {        while ($row = mysql_fetch_assoc($result)) {     <would I insert your code here to create the two columns? ... & replace $db_results with $row?>     } } [/code] Is there a better way to build a 2 column list of contact info from members in a MySQL table? btw... thank you for your help.
  11. Help!!! I'm trying to walk through an array and present the information back to the screen in two columns and about 6-10 rows. Here's the code I'm working with, but I keep getting 6-10 of each array element. What am I missing here: [code]           <table border="0" cellpadding="3" cellspacing="15" width="100%"> <?php $db_results = array("Jeff", "Bobbi-Jo", "Carol", "John", "Fred", "Barney", "Bubba", "Mary-Lou"); foreach($db_results as $values) {     for($rows=0; $rows<8; $rows++)     {     echo "<tr class=\"admin\" bgcolor=\"#E2D09E\">\n";         for($cols=0; $cols<2; $cols++)         {         echo "<td id=\"form_searchB\">\n";         echo "    <table align=\"left\" width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";         echo "        <tr valign=\"top\">\n";         echo "            <td class=\"form11\">\n";         echo "            <b>$values \n";         echo "            </td>\n";         echo "        </tr>\n";         echo "    </table>\n";         echo "  </td>\n";         }     echo "</tr>\n";     } } echo "</table>\n"; ?>                 </td>               </tr>         </table> [/code] I am new to PHP and I know my code looks pretty messy, but I'm open to suggestions. Thanks, Jeff
×
×
  • 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.