$query='SELECT *, UNIX_TIMESTAMP(`topic_created`) AS `topic_created`, UNIX_TIMESTAMP(`topic_bumped`) AS `topic_bumped`, UNIX_TIMESTAMP(`topic_locked`) AS `topic_locked`, UNIX_TIMESTAMP(`topic_resolved`) AS `topic_resolved`, UNIX_TIMESTAMP(`topic_confirmed`) AS `topic_confirmed`'
.' FROM `fmf_topics` WHERE `cat_id` = :category AND `topic_bumped` IS NOT NULL'
.' ORDER BY ';
if($variation===1)
$query.='IF(`topic_confirmed` IS NULL, 0, IF(`topic_resolved` IS NULL, -1, 1)), ';
$createTopic=$pdo->prepare('INSERT INTO `fmf_topics` (`cat_id`, `user_id`, `topic_title`) VALUES (:cat, :user, :title)');
$createTopic->bindValue('cat',$category);
$createTopic->bindValue('user',$user);
$createTopic->bindValue('title',$title);
$createTopic->execute();
return(int)$pdo->lastInsertId();
}
functiontopic_info(int$topic):array{
global$pdo;
if($topic<1)
return[];
$getTopic=$pdo->prepare('SELECT *, UNIX_TIMESTAMP(`topic_created`) AS `topic_created`, UNIX_TIMESTAMP(`topic_locked`) AS `topic_locked`, UNIX_TIMESTAMP(`topic_resolved`) AS `topic_resolved`, UNIX_TIMESTAMP(`topic_confirmed`) AS `topic_confirmed` FROM `fmf_topics` WHERE `topic_id` = :id');