I have this code wich gets WP posts, but it gets all the posts and orders them from the first to the last. I want only the last 10 post ordered from last to the earlier. What I have to change? Thanks a lot in advance!
<?php
$dbhost = 'localhost';
$dbuser = 'root';
$dbpass = '';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'myblog';
mysql_select_db($dbname);
$result = mysql_query("SELECT * FROM wp_posts WHERE post_type = 'post'")
while($row = mysql_fetch_array($result))
{
echo $row['post_date'] . " " . $row['post_content'] . " " $row['post_title'];
echo "<br />";
}
?>