Thanks in advance for checking out my problem.

Here is a fictional version of the scenario I am trying to achieve - let's say you are searching for a Department of Motor Vehicles office closest to you. So you go to a website and you plug in your zip code. What you get in return, is a table with four offices in that zip code. Glancing at this table you choose the office you want and you click on a "view details" button to go to another page with specifics about that particular office.. such as directions, phone numbers, etc.

The way I am currently set up is - you plug in your zip code (http://www.la-mason.com/2search.html - search for zip 71129) and you get a single webpage with excessive scroll down, listing all of companies in that zip code and all of their detailed information (directions, phone numbers, etc).

I have to break it down.. does that make sense? This link is a non-active graphical representation of what I need http://www.la-mason.com/2resultsA.phpis --- so when you click "View" it takes you to the detailed information of just that company.

THE DETAILS OF HOW I HAVE IT SET UP:
I have 3 tables: Lodges, Officers and Pics.
I'm currently able to display a company, their employees and a photo on my results page based on a $metode search.

SO my problem comes into play when the search is based on zip code or county and there are multiple companies returned. I have to give the user the option to choose which lodge they want in a particular zip code or county.

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

______________________________________________________________________
2search.html Code:
______________________________________________________________________

<form method="post" action="http://www.la-mason.com/2results.php"; target="_blank">
<div align="center">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td bordercolor="#000000">
<p align="center">
<select name="metode" size="1">
<option value="tblLodges.strLodgeName">Name</option>
<option value="tblLodges.intLodgeNumber">Number</option>
<option value="tblLodges.strDistrictName">District</option>
<option value="tblLodges.strLodgeLocationCity">City</option>
<option value="tblLodges.strLodgeLocationZIP">Zip</option>
<option value="tblLodges.strLodgeCounty">County</option>
</select> <input type="text" name="search" size="25">

Search database: <input type="submit" value="Go!!" name="Go"></p>
</td>
</tr>
</table>
</div>
</form>

_____________________________________________________________________
2results.php code:
_____________________________________________________________________
//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.strLodgeMailingAddress, tblLodges.strLodgeMailingAddress2, tblLodges.strLodgeMailingCity, tblLodges.strLodgeMailingPostCode, tblLodges.strLodgeEmail, tblLodges.strLodgePhone, tblLodges.strLodgeFax, tblLodges.strDrivingDirectons, tblLodges.dtMeetingTime, tblLodges.dtMealTime, tblLodges.strFloorSchool, tblLodges.strLodgeNews, tblOfficers.strOfficerTitle, tblOfficers.strFirstName, tblOfficers.strLastName, tblOfficers.BusinessPhone, tblOfficers.PersEmail FROM tblLodges LEFT JOIN tblOfficers ON tblLodges.lngLodgeID = tblOfficers.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["strLodgeMailingAddress"];
$variable8=$row["strLodgeMailingAddress2"];
$variable9=$row["strLodgeMailingCity"];
$variable10=$row["strLodgeMailingStateCode"];
$variable11=$row["strLodgeMailingPostCode"];
$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

echo ("<tr>");
echo "<center>\n";
echo "<p>GRAND LODGE OF LOUISIANA - LODGE LOCATOR RESULTS\n</p>";
echo "Lodge Name: $variable1</p>";
echo "<p>Lodge Number: $variable2</p>";
echo "<p>District Name: $variable3</p>";
echo "<a href=\"$variable4\">Click Here To Go To The Lodge Website[/url]";
echo "<p>Lodge County: $variable5</p>";
echo "<p>Lodge Chartered On: $variable6</p>";
echo "<p>Lodge Address: $variable7, $variable8</p>";
echo '<p>' . $variable9 . $variable10 . $variable11 . '</p>';
echo "Click Here To Email The Lodge";
echo "<p>Lodge Phone Number: $variable13, Lodge FAX Number: $variable14</p>";
echo "<p>Lodge Driving Directions: $variable15</p>";
echo "<p>Lodge Lodge Meeting Time: $variable16</p>";
echo "<p>Lodge Lodge Meal Time: $variable17</p>";
echo "<p>Lodge Floor School: $variable18</p>";
echo "<p>Lodge News: $variable19</p>";
echo "<img src='{$row}'>";
echo "</center>\n";
echo ("</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.strLodgeMailingCity, tblLodges.strLodgeMailingPostCode, tblLodges.strLodgeCounty, tblOfficers.strOfficerTitle, 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["strOfficerTitle"];
$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>");
}
?>
</body>
</html>

without reading your code cause I am tired this morning.
you need 1 page to be like the individual profile page which will handle the viewing of one item.

You need to add to that table an identifying number which auto incraments and is a key, call it "id" or something.

In your sql statement on your profile page.

SELECT * FROM tablename WHERE id = '$id';

This is assuming that you have earlier defined $id as $_GET and passed it through the url.

www.domain.com/profile.php?id=2

Would have been passed, and 2 would be given to $_GET

this should point you in the right direction, if you don't understand it, just ask.
Sage

This article has been dead for over six months. Start a new discussion instead.