latest_post

[insert_php]
$servername = “ap-cdbr-azure-southeast-a.cloudapp.net”;
$username = “bc467064c9281b”;
$password = “63d3b01b”;
$dbname = “sccblog26aqKYDr”;

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die(“Connection failed: ” . $conn->connect_error);
}

$sql = “SELECT wp.id as PostID,wp.post_title as Title,wp.post_content as description,wp.post_name as slug,wp.post_date as dateCreated, CONCAT(‘http://sccblog.azurewebsites.net/post/’,DATE_FORMAT(wp.post_date,’%Y/%m/%d’),’/’,wp.post_name) as PostPath FROM wp_term_taxonomy wtt inner join wp_term_relationships wtr on wtr.term_taxonomy_id=wtt.term_taxonomy_id inner join wp_posts wp on wp.id=wtr.object_id where wtt.taxonomy=’category’ and wtt.parent!=0 and wtt.term_taxonomy_id=10 order by wp.post_date desc limit 5”;
$result = $conn->query($sql);

if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo $row[“PostID”]. ” ” . $row[“slug”]. ”
“;
}
} else {
echo “0 results”;
}
$conn->close();
[/insert_php]