I want display authors'posts with the code below but authors' name aren't showing. What is wrong?
<? // query test
$qry = $wpdb->get_results( $wpdb->prepare("
SELECT *
FROM $wpdb->posts
WHERE post_type ='post'
AND post_status='publish'
order by 'ID' DESC
LIMIT 5
"));
echo "<table width=100% cellspacing=1 cellpadding=5 bgColor='#cccccc'>";
foreach ( $qry AS $k => $v ){
$qry_name = $wpdb->get_results( $wpdb->prepare("
SELECT user_nicename AS USER_NAME
FROM 'wp-users' AS a
LEFT JOIN 'wp-posts' AS b
ON a.ID = b.post_author
WHERE b.post_author = a.ID
"));
$ID = $v->ID;
$title = stripslashes(mb_substr($v->post_title, 0,20,"utf-8"));
$ddate = $v->post_modified;
$name = $v->user_nicename;
$link = '<a href=/archives/'.$ID.'>';
$list = "<tr><td bgColor='#ffffff'>".$ID."</td><td bgColor='#ffffff'>".$link.$target.$title."</a></td><td bgColor='#ffffff'> on ".$ddate."</td><td bgColor='#ffffff'>".$qry_name[0]->USER_NAME."</td></tr>";
echo $list;
}
echo "</table>";
?>