Files
cwsvJudo/homepage/wkParticipo/achievements.php

47 lines
2.4 KiB
PHP

<?php
// CREATE TABLE `cwsvjudo`.`achievements` ( `id` INT UNSIGNED NOT NULL AUTO_INCREMENT COMMENT 'id/primary key' , `name` VARCHAR(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL COMMENT 'name/caption of the Achivement' , `previousId` INT NOT NULL COMMENT 'id of the previous achievement' , `description` TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT 'full descriptiopn in markdown' , PRIMARY KEY (`id`)) ENGINE = InnoDB CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT = 'eine Liste mit Achievements'; require_once('./local/db.php.inc');
setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
require_once('./local/wkParticipoConf.php.inc');
require_once('./auth.php');
require_once('./local/db.php.inc');
require_once('./lib/wkParticipoLib.inc.php');
$basePath = "/users/cwsvjudo/www";
require_once($basePath."/config/cwsvJudo.config.php");
require_once($basePath."/config/phpcount.config.php");
require_once($basePath."/ressourcen/phpLib/phpcount/phpcount.php");
require_once($basePath."/ressourcen/phpLib/cwsvJudo/miscAssis.php");
$dbConnection = getCwsvJudoDbConn();
try{
$results = dbQuery(
$dbConnection,
//"INSERT INTO `wkParticipo_user<=>userAttributes` (userId, attributeId) VALUES (:userId, :attributeId);",
"SELECT * FROM cwsvjudo.achievements;"
//array(
// ':userId' => array('value'=>$anUserId, 'data_type'=>PDO::PARAM_INT),
// ':attributeId'=> array('value'=>$anAttributeId, 'data_type'=>PDO::PARAM_INT)
//)
);
}
catch(PDOException $db_error){
print "Error!: " . $db_error->getMessage() . "<br/>queryString: ".$queryString."<br />"; var_dump($bindArray);
}
// $query = "WITH SortedList (id, previousId, name, Level) AS ( SELECT Id, ParentId, SomeData, 0 as Level FROM cwsvjudo.achievements WHERE `id` IS 1 UNION ALL SELECT ll.id, ll.previousId, ll.name, Level+1 as Level FROM cwsvjudo.achievements ll INNER JOIN SortedList as s ON ll.previousId = s.Id ); SELECT id, previousId, name FROM SortedList ORDER BY Level ";
// $query = "SELECT (id, name, rootId, level) FROM cwsvjudo.achievements WHERE `id` = 1 ORDER BY `level`;";
// $query = "SELECT * FROM cwsvjudo.achievements;";
// $results = $mysqlConn->query($query);
// var_dump($results);
?>
<html>
<body>
<?php echo( arrayKeyed2htmlTableString($results, ["id", "name", "rootId", "level", "description"], $withCaption = true) );?>
</body>
</html>