I have a php file that calls a smarty template, it works and all of the variables are passing correctly. The php files that do not require a smarty template are connecting to the database with no problems. THE PROBLEM: anytime I enter a PDO statement the page loads as a blank html instead of the template.
<?php
session_name('login');
session_start();
if(!isset($_SESSION['username'])){
header("Location: login.php");
}
include(connect.php);
function getCats()
{
$cat = $db->prepare("SELECT * FROM `categories`");
$cat->execute();
$categories = $cat->fetchAll();
return $categories;
}
require('./Smarty-3.1.13/libs/Smarty.class.php');
$smarty = new Smarty;
$smarty->assign("catinfo", getCats());
$smarty->assign("pageType", "1");
$smarty->display('index.tpl');
?>
The smarty template section that deals with this looks like this.
{foreach from=$catinfo item='cat'}
<div class="category">
{foreach from=$cat item='info'}
<div class="catAttribute">{$info}</div>
{/foreach}
This is what the table contains:
CREATE TABLE `categories` (
`category` VARCHAR(20),
`count` INT(10),
`message` TEXT,
PRIMARY KEY(`category`)
);