Login   Register  
PHP Classes
elePHPant
Icontem

File: templates/show_data_db.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Costin Trifan  >  AbsTemplate  >  templates/show_data_db.php  >  Download  
File: templates/show_data_db.php
Role: Application script
Content type: text/plain
Description: The database connection template file
Class: AbsTemplate
Template engine based PHP script templates
Author: By
Last change:
Date: 5 years ago
Size: 475 bytes
 

Contents

Class file image Download
<?php
/*
:: Retrieve and display all posts from a Wordpress blog
*/
function GetPosts()
{
    
$con mysql_connect('localhost','username','password');
    
mysql_select_db('wp-database-name',$con);
    
$query mysql_query("SELECT post_title FROM wp_posts",$con);
    
    
$html '';
    while(
$row mysql_fetch_assoc($query))
        
$html .= '<p><strong>'.$row['post_title'].'</strong></p>';

    return 
$html;
}
?>

<div>
    <h2> {title} </h2>

    <?php echo GetPosts(); ?>
</div>