You can use the WP_Query class to avoid mixing global table columns with your custom loop.
$results = new WP_Query('posts_per_page');
if ($results->have-posts()) {
while ($results->have_posts()) {
$results->the_post();
the_title();
}
}
unset($results);
source
share