adaminms Posted February 17, 2010 Share Posted February 17, 2010 I want to make a site that has two different groups of people. Note, this is all under the same database, just using two different tables. One table has one group of people while the other has another. I want Group 1 to be able to be able to find all of the people in group 2 that have information in common. Not necessarily all of the information identical, but I want it to be organized something like this... Group 1 Member 1 searches, and he finds a few results. Group 2 Member 8 has 3 things in common. Group 2 Member 92 has 3 things in common. Group 2 Member 16 has 2... And then just list them from the most things in common, down to the least. Link to comment https://forums.phpfreaks.com/topic/192332-comparing-two-database-tables/ Share on other sites More sharing options...
adaminms Posted February 17, 2010 Author Share Posted February 17, 2010 Anyone? Link to comment https://forums.phpfreaks.com/topic/192332-comparing-two-database-tables/#findComment-1013541 Share on other sites More sharing options...
adaminms Posted February 17, 2010 Author Share Posted February 17, 2010 Bump Link to comment https://forums.phpfreaks.com/topic/192332-comparing-two-database-tables/#findComment-1013980 Share on other sites More sharing options...
shlumph Posted February 17, 2010 Share Posted February 17, 2010 What does your table structure look like now? And are two tables necessary? Why not have a table, "groups" then a table "users", where many users can belong to a single (or multiple) group(s)? Link to comment https://forums.phpfreaks.com/topic/192332-comparing-two-database-tables/#findComment-1013982 Share on other sites More sharing options...
adaminms Posted February 18, 2010 Author Share Posted February 18, 2010 It's better if I just explain what it's for. This is want I want to actually happen in the programming. Step 1 Employees put in their information. Step 2 Information is saved to the Employees database. Step 3 Information in the Employers is cross-referenced with the information the Employee put in. Step 4 A list of information is made, starting with the row of information with the most in common to the information that the Employee gave, and ends with the least in common. Link to comment https://forums.phpfreaks.com/topic/192332-comparing-two-database-tables/#findComment-1014127 Share on other sites More sharing options...
shlumph Posted February 18, 2010 Share Posted February 18, 2010 Perhaps something like this is what you're looking for: //get the count, used to find percentages $sql = "SELECT COUNT(id) FROM employers"; //find how common a certain field is $sql = "SELECT COUNT(id) FROM employers WHERE gender = 'MALE'"; //find another certain field, etc., etc. storing the results in an key/value array //where the value is the percentage //Then just sort the array and print it out Not sure if the is the best solution Link to comment https://forums.phpfreaks.com/topic/192332-comparing-two-database-tables/#findComment-1014308 Share on other sites More sharing options...
adaminms Posted February 19, 2010 Author Share Posted February 19, 2010 That's a great idea. I'm not as familiar with PHP as you guys are. In fact, the only web languages I know in depth are HTML and CSS. Is there a way to select the text box instead of just putting in 'Male'? Link to comment https://forums.phpfreaks.com/topic/192332-comparing-two-database-tables/#findComment-1015065 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.