Skip to content

Instantly share code, notes, and snippets.

@onpubcom
Last active September 30, 2015 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onpubcom/1756030 to your computer and use it in GitHub Desktop.
Save onpubcom/1756030 to your computer and use it in GitHub Desktop.
<?php
// See the following OnpubAPI tutorial for more info:
// http://onpubco.com/index.php?articleID=76&sectionID=2
// Establish the connection to the Onpub database.
$pdo = new PDO( "mysql:host=localhost;dbname=test", "test", "test" );
// Include the OnpubAPI classes.
include 'onpub/api/onpubapi.php';
// Construct an OnpubArticles object. This represents the OnpubArticles table
// in the database.
$oarticles = new OnpubArticles($pdo);
// Output the number of articles currently stored in the database.
echo $oarticles->count();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment