<?php
$db_username = '#######';
$db_password = '#######';
$db_database = '#######';
$blog_url = 'http://www.#######.com/#######/blog/'; //base folder for the blog. Make SURE there is a slash at the end
//connect to the database
$con = mysql_connect(localhost, $db_username, $db_password);
@mysql_select_db($db_database) or die("Unable to select database");
$query = "Select * FROM wp_posts WHERE post_type='post' AND post_status='publish' ORDER BY id DESC LIMIT 2";
$query_result = mysql_query($query);
while($row = mysql_fetch_array($query_result))
{
?>
<div class="blog_cont"> <a>"><b><?php echo $row['post_title'] ?></b></a><br clear="all" />
<span><?php if (strlen($row['post_content']) > 40) { echo substr($row['post_content'], 0, 120) . '...'; } ?></span> <a>">Read More »</a> </div>
<?php }
@mysql_close($con);
?>
↧
Dubai Web Design - incirclemedia.com on "Solution to display recent posts from blog to website"
↧