Hi as I mentioned in last question that I am learning class and method in php so I have another problem to understand how to use this query method to output the result in theme.
I am trying with WordPress at the moment so please consider it. However it is not too generic with WordPress rather the logic.
<?php
class get_user_widget
{
// other mentods are here which is not related to below method
public static function get_users() {
global $wpdb;
$query = "SELECT id, user_login FROM $wpdb->users ORDER BY user_registered DESC";
$users = $wpdb->get_results($query);
// here I am using foreach so is it okay or while loop is right to use?
foreach ($users as $users)
$rs[] = $users;
return count($rs) ? $rs : array();
}
}
?>
So how can I use this in theme to render the output list of user by registered date? I have checked with print_r() and connection and everything is fine and getting output in array but need to use html.
Thanks a lot..
The class can be used like this:
EDIT: