I wasnt sure if MySQL version 5 has changed this, so I stated my version in the topic.
Im trying to pull a count set from 2 tables and return it with a union like so;
$sql = $db->query('SELECT count(*) as total_users
FROM c_users
UNION
SELECT count(*) as total_online
FROM c_active');
while($row = $sql->fetch()) {
print_r($row);
}
Now, as you can see I've attempted to label the first result set total_users and the 2nd result set total_online. This does not work, as both sets are being named total_users.
Any advice? I've read the MySQL Manual page on Unions and the closest thing I can find still wont label the rows as needed.
Is this even possible?
Thanks