Firstly, I am PHP-tarded and appreciate any help. So, thanks in advance.
Goal: To echo query results and delete duplicated "company" results. I have a table with the following columns: id, Installer, company, address, phone, endorsements, parish
The "id" is the primary key, the "installer" is the first and last name of an individual excavation equipment operator and "company" is the company the installer works for, "parish" is like a county... but I am in Louisiana..so parish. I have a drop-down menu with all the parishes listed. When a parish is selected, all the installers and their associated companies is displayed on a web page. My problem is that one company can have multiple installers which causes the companies to be listed multiple times. I would like each company to be listed only one time.
Here is my PHP code:
getuser.php
<?php
$q=$_GET["q"];
$con = mysql_connect('000.000.000.000', 'shanehward', '********');
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("shanehward", $con);
$sql="SELECT * FROM installer_list WHERE Parish = '".$q."'";
$result = mysql_query($sql);
echo "<table border='1'>
<thead>
<tr>
<th>Company</th>
<th>Address</th>
<th>City</th>
<th>Endorsements</th>
<th>Phone</th>
</tr>
</thead>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['Company'] . "</td>";
echo "<td>" . $row['Address'] . "</td>";
echo "<td>" . $row['City'] . "</td>";
echo "<td>" . $row['Endorsements'] . "</td>";
echo "<td>" . $row['Phone'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
Thanks again for any input.