select statement
Posted: Fri Feb 19, 2010 2:12 pm
I need for the following to only post the first 5 listings and not all of them. How can I modify this to make it work?
Code: Select all
<?php
$data = mysql_query("SELECT post_date, post_title, post_status, post_type FROM wp_posts ORDER BY post_date ASC ") or die(mysql_error());
//Puts it into an array
while($info = mysql_fetch_array( $data ))
if($info['post_status'] == 'publish'){
if($info['post_type'] == 'post'){
echo"<li>".$info['post_title'] . "</li>";
}
else{
}
}
else{
}
?>