Jump to content

How to seperate duplicate data - I don' t know what to do...


JTapp

Recommended Posts

Thanks in advance for checking out my topic.

 

I have 3 tables... let's just say they are companies, employees, and company photos. 

I'm currently able to display a company, their employees and a photo on my results page based on a $metode search.

 

My problem comes into play when the search is based on zip code or county and there are multiple companies returned.

Not only are all of the employees grouped together in a single table at the bottom of the page (when they should be seperated into the section appropriate for the corresponding company) but also, when there are multiple companies, the returned results create a bunch of scroll down and its hard to find which company you may be looking for.  Its almost like I need to put a "bookmark" of just the company name at the top of the page or something.

 

The code is below, but to see what I am talking about go to:

For the single company display: http://www.la-mason.com/search.html and select  "Lodge Name" and search for "Abbeville".

For the crazy multiple company display: http://www.la-mason.com/search.html and select "Lodge County" and search for "county".

 

//error message (not found message)begins

$XX = "No Record Found, to search again please close this window";

//query details table begins

$query = mysql_query("SELECT tblLodges.strLodgeName, tblLodges.intLodgeNumber, tblLodges.strDistrictName, tblLodges.strLodgeWEB, tblLodges.strLodgeCounty, tblLodges.dtChartered, tblLodges.strLodgeAddress, tblLodges.strLodgeAddress2, tblLodges.strLodgeLocationCity, tblLodges.strLodgeLocationState, tblLodges.strLodgeLocationZip, tblLodges.strLodgeEmail, tblLodges.strLodgePhone, tblLodges.strLodgeFax,  tblLodges.strDrivingDirectons, tblLodges.dtMeetingTime, tblLodges.dtMealTime, tblLodges.strFloorSchool, tblLodges.strLodgeNews, tblOfficers.strFirstName, tblOfficers.strLastName, tblLodgePics.link FROM tblLodges LEFT JOIN tblOfficers ON tblLodges.lngLodgeID = tblOfficers.lngLodgeID LEFT JOIN tblLodgePics ON tblLodgePics.lngLodgeID = tblLodges.lngLodgeID WHERE $metode LIKE '%$search%' GROUP BY tblLodges.strLodgeName LIMIT 0, 50");

while ($row = @mysql_fetch_array($query))

{

$variable1=$row["strLodgeName"];

$variable2=$row["intLodgeNumber"];

$variable3=$row["strDistrictName"];

$variable4=$row["strLodgeWEB"];

$variable5=$row["strLodgeCounty"];

$variable6=$row["dtChartered"];

$variable7=$row["strLodgeAddress"];

$variable8=$row["strLodgeAddress2"];

$variable9=$row["strLodgeLocationCity"];

$variable10=$row["strLodgeLocationState"];

$variable11=$row["strLodgeLocationZip"];

$variable12=$row["strLodgeEmail"];

$variable13=$row["strLodgePhone"];

$variable14=$row["strLodgeFax"];

$variable15=$row["strDrivingDirectons"];

$variable16=$row["dtMeetingTime"];

$variable17=$row["dtMealTime"];

$variable18=$row["strFloorSchool"];

$variable19=$row["strLodgeNews"];

$variable20=$row["link"];

//table layout for results

 

print ("<tr>");

echo "<center>\n";

echo "<p><b>GRAND LODGE OF LOUISIANA - LODGE LOCATOR RESULTS</b>\n</p>";

echo "<b>Lodge Name:</b> $variable1</p>";

echo "<p><b>Lodge Number:</b> $variable2</p>";

echo "<p><b>District Name:</b> $variable3</p>";

echo "<a href=\"$variable4\">Click Here To Go To The Lodge Website</a>";

echo "<p><b>Lodge County:</b> $variable5</p>";

echo "<p><b>Lodge Chartered On:</b> $variable6</p>";

echo "<p><b>Lodge Address:</b> $variable7, $variable8</p>";

echo '<p>' . $variable9 . $variable10 . $variable11 . '</p>';

echo "<a href=mailto:\"$variable12\">Click Here To Email The Lodge</a>";

echo "<p><b>Lodge Phone Number:</b> $variable13, <b>Lodge FAX Number:</b> $variable14</p>";

echo "<p><b>Lodge Driving Directions:</b> $variable15</p>";

echo "<p><b>Lodge Lodge Meeting Time:</b> $variable16</p>";

echo "<p><b>Lodge Lodge Meal Time:</b> $variable17</p>";

echo "<p><b>Lodge Floor School:</b> $variable18</p>";

echo "<p><b>Lodge News:</b> $variable19</p>";

echo "<img src='{$row['link']}'>";

echo "</center>\n";

print ("</tr>");

}

?>                              </tr>

                            </table>

                            <hr width=75% align=center size=4>

<?php

//query details table begins

$query = mysql_query("SELECT tblLodges.strLodgeName, tblLodges.intLodgeNumber, tblLodges.strDistrictName, tblLodges.strLodgeLocationCity, tblLodges.strLodgeLocationZip, tblLodges.strLodgeCounty, tblOfficers.lngOfficerTitleID, tblOfficers.strFirstName, tblOfficers.strLastName, tblOfficers.BusinessPhone, tblOfficers.PersEmail FROM tblLodges LEFT JOIN tblOfficers ON tblLodges.lngLodgeID = tblOfficers.lngLodgeID WHERE $metode LIKE '%$search%' LIMIT 0, 50");

 

$results=mysql_query($query);

echo "<center>\n";

echo "<H2>Roster of Lodge Officers</H2>\n";

echo "<table border='1'>

  <tr>

<th>Officer Title</th>

<th>Officer First</th>

<th>Officer Last</th>

<th>Officer Email</th>

<th>Officer Phone</th>

 

</tr>";

//

 

while ($row = mysql_fetch_array($query))

{

$variable1=$row["lngOfficerTitleID"];

$variable2=$row["strFirstName"];

$variable3=$row["strLastName"];

$variable4=$row["PersEmail"];

$variable5=$row["BusinessPhone"];

 

//table layout for results

 

print ("<tr>");

echo "<tr align=\"center\" bgcolor=\"#EFEFEF\">\n";

echo "<td class=\"td_id\">$variable1</td>\n";

echo "<td class=\"td_id\">$variable2</td>\n";

echo "<td class=\"td_id\">$variable3</td>\n";

echo "<td class=\"td_id\">$variable4</td>\n";

echo "<td class=\"td_id\">$variable5</td>\n";

print ("</tr>");

}

?>

 

 

 

 

Link to comment
Share on other sites

Guest
This topic is now 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.