Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('classes/db.php');
- require_once('classes/post.php');
- $db = new database('localhost', 'xx', 'yy');
- $db->connect();
- $db->selectDB('xx');
- $posts = array();
- function loadPosts(){
- $result = mysql_query("SELECT * FROM posts") or die ("Could not get data: ".mysql_error());
- while($row = mysql_fetch_array($result)){
- $posts[] = new post($row['headline'], $row['body'], $row['date']);
- }
- // Size of posts -> 1
- }
- // Size of posts -> 0 dafuck?
- function listPosts(){
- for($i = 0; $i <= sizeof($posts); $i++){
- $posts[$i]->printPost();
- }
- }
- ?>
Add Comment
Please, Sign In to add comment