wbcmc/setup.php

20 lines
535 B
PHP
Raw Permalink Normal View History

2019-07-26 18:05:19 +00:00
<?php
2019-07-28 11:30:43 +00:00
$conffile=parse_ini_file("config.ini.php");
$dsn=$conffile["dialect"].':'.$conffile["dsn"];
2019-07-28 11:30:43 +00:00
2019-07-26 18:05:19 +00:00
$id=0;
if(!is_null($_GET["id"]) and is_numeric($_GET["id"])){
2019-07-28 11:30:43 +00:00
$id=$_GET["id"];
2019-07-26 18:05:19 +00:00
}
2019-07-28 11:30:43 +00:00
try{
$pdo=new PDO($dsn,$conffile["user"],$conffile["password"]);
}catch(\PDOException $e){
throw new \PDOException($e->getMessage(), (int)$e->getCode());
2019-07-26 18:05:19 +00:00
}
2019-07-28 11:30:43 +00:00
$string="SELECT id,file,title,hover FROM comics ORDER BY CASE WHEN (id=?) THEN 0 ELSE 1 END, id DESC";
$qry=$pdo->prepare($string);
$qry->execute([$id]);
$comic=$qry->fetch(PDO::FETCH_ASSOC);
2019-07-26 18:05:19 +00:00
?>