I have had a look within daniweb and done google searches on this problem so hopefully I am not wasting anybodys time with this. The problem I am facing is that currently I am getting the results from a mysql database using an associative array but i need to be able to compare one row of results to another. Here is the code I am using at the moment, the table has the fields pos, team, pld, won, lst, scr and con:
$result = new mysqli('localhost', 'webuser', 'userpass', 'stocker_soccer');
if(!$result) {
throw new Exception('Could not connect to the database server');
} else {
return $result;
}
//query the database for the table data
$query3 = "select * from league_1 order by Pos asc";
$result3 = $conn->query($query3);
$num_results = $result3->num_rows;
for($i = 0; $i < $num_results; $i++) {
$row = $result3->fetch_assoc();
echo "<tr><td>".$row['Pos']."</td><td>".$row['Team']."</td>
<td>".$row['Pld']."</td><td>".$row['Won']."</td><td>".$row['Drn']."</td>
<td>".$row['Lst']."</td><td>".$row['Scr']."</td><td>".$row['Con']."</td>
<td>".$goal_diff."</td><td>".$points."</td><td>
<a href='table_update.php?id=".$row['id']."'>Edit Team</a></td></tr>";
}
I need to be able to compare each result row with another result row, but I do not know how to do this with what I have so far. any help with this problem would be very appreciated. I am using mysqli to access the database.