How to Query Updated Post in WordPress

You can use this query from perishablepress.com to get post revisions.

<?php 

$today  = current_time('mysql', 1);
$number = 5; // number of posts

if($recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status="publish" AND post_modified_gmt < '$today' ORDER BY post_modified_gmt DESC LIMIT $number")):

?>

<h2><?php _e('Recently Updated'); ?></h2>
<ul>
<?php

foreach($recentposts as $post) {

    if($post->post_title == '') $post->post_title = sprintf(__('Post #%s'), $post->ID);
    echo '<li><a href="'.get_permalink($post->ID).'">'.the_title().'</a></li>';

} ?>
</ul>

<?php endif; ?>

This queries the database according to the post_modified_gmt time of a post, and then also ordered the returned posts according to post_modified_gmt

error code: 523