I have the below code that grabs all the data I need, but as there are duplicate names in each row, I only want to display this once as a heading, and then display the array.
<?php
echo "<h1>Results Summary</h1>";
//TABLE RESULTS
$psba = $_POST['psba'];
$con = mysql_connect("localhost","root","");
mysql_select_db('project', $con) or die('Cant Connect');
$result = mysql_query("SELECT * FROM mpf WHERE psba = '".$psba."'");
echo "<h1>".$psba."</h1><br />";
while($row = mysql_fetch_array($result))
{
$pair = $row['pair'];
$project =$row['project'];
$psba = $row['psba'];
$hostname = $row['name'];
$circuit = $row['circuit'];
echo $pair;
echo $hostname;
echo $circuit."<br />";
}
?>
so shows this:
1Chepstow Community Hospital CCHLLSW0508002
2Chepstow Community Hospital CCHLLSW0508004
3Chepstow Community Hospital CCHLLSW0508001
4Chepstow Community Hospital CCHLLSW0508003
the first row and last row are the ones I need, but I have to have the hostname in the array, otherwise I cant display it?
I need it too grab the data, display $hostname as a heading, then the $pair and $circuit in the loop..
I cant seem to work it out,
thanks