Location: PHPKode > scripts > Particle Gallery > install/upgrade/from_0.1.1.php
<?php
require("../../includes/global.php");

$sql = "SELECT * FROM " . $dbprefix . "config WHERE config_name = 'versionint'";
$rec = $db->execute($sql);
$version = intval($rec->fields["config_value"]);

// check version
if ($version <> 1){ die("You are not running version 0.1.1"); }

// run the main SQL
$filename =  "../schema/upgrade_from_0.1.1.sql";
$contents = implode("", file($filename)); // join it into one string
$contents = str_replace("pg_", $dbprefix, $contents);
$contents = str_replace("\r\n", "\n", $contents); // convert to Unix EOL format if needed
$queries = explode(";\n", $contents); // split into separate queries
foreach ($queries as $query) {
	$result = $db->execute($query);
}

// run the update SQL
$sql = "UPDATE " . $dbprefix . "config SET config_value = '1.0.0' WHERE config_name = 'version'";
$db->execute($sql);

$sql = "UPDATE " . $dbprefix . "config SET config_value = 2 WHERE config_name = 'versionint'";
$db->execute($sql);

// and notify user
Header("Location: from_1.0.0.php");
?>
Return current item: Particle Gallery