Ejemplo n.º 1
0
<?php

require_once '../include/ticket_db.php';
require_once 'err.php';
require_once '../public_html/DbUtils.php';
print_message("Creating Sports table.......");
$dbh = mysql_connect($host_name, $db_username, $db_password) or die('CreateSportsTable: I cannot connect to the database because: ' . mysql_error());
mysql_select_db($db_name);
$bsql = "DROP TABLE IF EXISTS CategoryToSportName_temp";
$query_result = mysql_query($bsql) or die('CreateSportsTable: DROP TABLE CategoryToSportName_temp failed: ' . mysql_error());
$bsql = "CREATE TABLE CategoryToSportName_temp(\n        \t CategoryID INT NOT NULL,\n               \t SportName CHAR(100),\n                 PRIMARY KEY (CategoryID)\n        )";
$query_result = mysql_query($bsql) or die('CreateSportsTable: ' . mysql_error());
$bsql = "SELECT CategoryID,CategoryName FROM AdjacencyListCategories_temp WHERE ParentCategoryID=3";
$result = mysql_query($bsql) or die('CreateSportsTable: ' . mysql_error());
while ($row = mysql_fetch_array($result)) {
    $top_level_categories[] = array('id' => $row['CategoryID'], 'name' => $row['CategoryName']);
}
mysql_free_result($result);
for ($i = 0; $i < count($top_level_categories); $i++) {
    $categories = GetAllSubordinatesOfCategory('ModifiedPreorderTreeTraversalCategories_temp', $top_level_categories[$i]['id']);
    $categoryName = strtolower($top_level_categories[$i]['name']);
    $result = mysql_query("INSERT INTO CategoryToSportName_temp (CategoryID, SportName) VALUES (" . $top_level_categories[$i]['id'] . ",'" . $categoryName . "')") or die('CreateSportsTable: ' . mysql_error());
    for ($j = 0; $j < count($categories); $j++) {
        $result = mysql_query("INSERT INTO CategoryToSportName_temp (CategoryID, SportName) VALUES (" . $categories[$j]['id'] . ",'" . $categoryName . "')") or die('CreateSportsTable: ' . mysql_error());
    }
}
mysql_close($dbh);
Ejemplo n.º 2
0
$smarty = new Smarty();
$smarty->template_dir = '../smarty/templates/new_urls/';
$smarty->compile_dir = '../smarty/templates_c/new_urls/';
$smarty->cache_dir = '../smarty/cache/new_urls/';
$smarty->config_dir = '../smarty/configs';
$smarty->compile_check = true;
$smarty->assign("RootUrl", $root_url);
$smarty->display('main.tpl');
if ($dbh = mysql_connect($host_name, $db_username, $db_password)) {
    mysql_select_db($db_name);
    echo '<div id="content">';
    echo '<div class="left_bar">';
    $top_level_categoryid_list = array("Sports" => 3, "Concert" => 2, "Theater" => 4);
    foreach ($top_level_categoryid_list as $categoryName => $categoryID) {
        echo "<div class=\"sitemapSection\">" . "<div><a class=\"sitemapHeading\" href=\"{$root_url}/" . strtolower($categoryName) . "-tickets/\">{$categoryName}</a>" . "</div>";
        $childCategoryIDList = GetAllSubordinatesOfCategory('ModifiedPreorderTreeTraversalCategories', $categoryID);
        foreach ($childCategoryIDList as $childCategoryIDArray) {
            $url = make_category_url($childCategoryIDArray['name']);
            echo "<div class=\"indent_" . $childCategoryIDArray['depth'] . "\">" . "<a href=\"{$url}\">" . $childCategoryIDArray['name'] . "</a>" . "</div>";
            #$indent++;
        }
        echo "</div>";
    }
    echo '</div> <!-- end left_bar -->';
    $smarty->display('right_bar.tpl');
    $smarty->display('left_column.tpl');
    # content to be closed by footer, echo "</div>";
}
$smarty->display('footer.tpl');
?>