header('Cache-Control: no-cache, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Content-type: application/json'); } else { header('Cache-Control: no-cache, must-revalidate'); header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); header('Content-type: application/x-javascript'); } if (!$type || $type == 'random') { /** * output as JSON */ $p_json = ''; $adddate_json = ''; $content_json = ''; if ($RandomQuote->db_table_exists($SQLITE_CACHE, $cache_json_table_name)) { $SQL = "SELECT `adddate`, `content` "; $SQL .= "FROM `" . $cache_json_table_name . "` "; $SQL .= " WHERE `adddate`!='' AND `content`!='' LIMIT :limit;"; $STH = $SQLITE_CACHE->prepare($SQL); $a = null; /** * http://www.if-not-true-then-false.com/2012/php-pdo-sqlite3-example/ * http://php.net/manual/en/sqlite3stmt.bindvalue.php */ $a[] = array(":limit", (int) 1); for ($i = 0; $i < count($a); $i++) { if (!empty($a[$i][0])) { $STH->bindValue($a[$i][0], $a[$i][1]); } }