Not sure where to post it, this seemed the most appropriate place.
Im look to pull data from the xf database - new threads made in a certain forum and show them on an external page, on the same domain and web server. e.g >
New post made in News & Announcements > INSERT data into database (forum_, table: xf_threads)
External webpage > connects to database > looks in forum_ > xf_threads > field: node_id=4 for new threads (first post only) > pulls data > places on external webpage.
Pretty sure thats how it should go database wise anyway. I cant seem to figure out the code lol. i got this far:
	
	
	
		
Now, in theory that should work, well.. it does on a cms script ive just coded and it works fine. All i did here was just edit the values to match the xf database..
Any ideas?
				
			Im look to pull data from the xf database - new threads made in a certain forum and show them on an external page, on the same domain and web server. e.g >
New post made in News & Announcements > INSERT data into database (forum_, table: xf_threads)
External webpage > connects to database > looks in forum_ > xf_threads > field: node_id=4 for new threads (first post only) > pulls data > places on external webpage.
Pretty sure thats how it should go database wise anyway. I cant seem to figure out the code lol. i got this far:
		Code:
	
	<?php
try {
    $pdo = new PDO('mysql:host=localhost;dbname=forum_', 'username', 'password');
} catch (PDOException $e) {
    exit('Database Error.');
}
class Article {
        public function fetch_all() {
                global $pdo;
                $query = $pdo->prepare("SELECT * FROM xf_threads");
                $query->execute();
                return $query->fetchAll();
        }
        public function fetch_data($node_id) {
            global $pdo;
            $query = $pdo->prepare("SELECT * FROM xf_threads WHERE node_id = 4");
            $query->execute();
            return $query->fetch();
        }
}
?>Now, in theory that should work, well.. it does on a cms script ive just coded and it works fine. All i did here was just edit the values to match the xf database..
Any ideas?
 
 
		
