i have table in database like this:
name date year
John 1/5/15 2015
Maria 3/3/15 2015
John 7/3/16 2016
Steve 5/2/16 2016
Steve 9/7/17 2017
John 9/1/17 2017
And want to get table like this:
Name 2015 2016 2017
John 1/5/15 7/3/16 9/1/17
Maria 3/3/15
Steve 5/2/16 9/7/17
I tried with this query:
$sql = "SELECT DISTINCT(name),date,year FROM table ORDER BY name ASC";
$query = $conn->query($sql);
Now I don't know what loop to use to get data to look like in second table.
I tried with this code
while($row = $query->fetch_assoc()) {
<td>" . $row["prezime_ime"] . "</td>
<td>" . ($row["date"]) . "</td>
Now I'm stuck here. I'm new to PHP so please can anyone help me. Thanks a lot