So, everytime when someone registers on my server, their IP get's saved on ROW named "IP".
I want to get, every "USERNAME" row, by the same "IP" row saved.
Eg: Accounts: Mike, John are saved on IP 127.0.0.1
I want to select IP 127.0.0.1 and show me Mike, John.
Currently I did this:
$sql10 = "SELECT IP, username, pHour FROM users order by pHour DESC LIMIT 5;";
$results10 = array();
$result10 = mysqli_query($con,$sql10);
$results10 = mysqli_fetch_all($result10, MYSQLI_ASSOC);
$output10 = '';
foreach ($results10 as $row) {
$output10 .= ' ' . $row['username'] . ' and ' . $row['pHour'] . '
';
}
I think that, I should add
SELECT username, IP, pHour FROM users WHERE IP = '$row['IP']' order by pHour
I'm on a good way to do it or not even close?
Simply, I want to get every username and pHour from the row 'IP'