I am having problems with query in xPDO i have some custom table like this
id | Name | useriD | bID | email
In row i have something like this
When i try in phpmyadmin a simple query
SELECT COUNT(`Name`) AS `Requests`, `Name` AS `Names`
FROM `table`
GROUP BY `Names`
ORDER BY `Requests` DESC
LIMIT 5
I got proper results
Requests | Names
--------------------------
3 | John
3 | Michael
1 | Jovan
1 | Oliver
1 | Peter
But when i try something like this
$result = $modx->query("SELECT COUNT(`Name`) AS `Requests`, `Name` AS `Names`
FROM `table`
GROUP BY `Names`
ORDER BY `Requests` DESC
LIMIT 5");
if (!is_object($result)) {
return 'No result!';
}
else {
while($row = $result->fetch(PDO::FETCH_ASSOC))
{
print_r($row);
}
}
The problem is that i dont know how to display this in table?
[ed. note: miomir.dancevic last edited this post 8 years, 3 months ago.]