This started in the mysql forum and now it is a php issue.
This query when run in phpmyadmin,
$q2 = "
SELECT Attribute
, Value
FROM radcheck
WHERE Attribute = 'Max-All-Session'
AND Username = 'loren'
UNION
SELECT Attribute
, Value
FROM radcheck
WHERE Attribute = 'Expiration'
AND Username = 'loren'
";
gives
Attribute Value
Max-All-Session 2592000
Expiration 1442281403
This has been a learning day for me. I was really hoping I would not need a loop. I wanted to get it all in an array, kind of like the results of this.
SELECT Attribute
, Value
, id
, op
FROM radcheck
WHERE Username = 'loren'";
This is for a radius database and will be part of a larger query with 3 joins on 4 tables going on. I need data on each user such as total bandwidth used, time used, time used up and then I run that through a loop to get the data on each user.
I’m trying to avoid an additional query in the loop. The WHERE username = ‘loren’ will go away so that all users will be displayed and the results will be paged.
I’m almost ready to set up a separate table to hold the expiration value.
I can see what I want cannot be done the way I want (stupid EAV). So now it’s an extra query or a storage table for expiration values. I think I will go out and pull petals off of a big flower
Thank you all for your help, It is greatly appreciated.
Cheers