I have next situation.
- From PHP form i get only COMPANY ID
- I need array all usernames with that companny ID
- I need array and export to table all logs with that usernames
My problem was, when i try next:
$sql2 = "SELECT vpnuserreg FROM users WHERE company='$company'";
$result2 = $database->query($sql2);
while ($row2 = $database->fetch_array($result2)){
$username = $row2['vpnuserreg'];
$sql = "SELECT * FROM logs WHERE username='$username' ORDER BY radacctid DESC";
$result = $database->query($sql);
$row=$database->fetch_array($result);
}
Problem was: In $sql2 query i have only 3 users and my log in $sql query will repat only 3 times. But i have more then 3 logs for thet user. How can i make sql query that my log export ALL row in table with only 3 usernames?