Exemple #1
0
session_start();
class MyDB extends SQLite3
{
    function __construct()
    {
        $this->open('../../fitdayDB.db');
    }
}
$db = new MyDB();
if (!$db) {
    echo $db->lastErrorMsg();
}
$type = $_GET['type'];
if ($type == "list") {
    $posttype = $_GET['posttype'];
    getPostType($posttype, $db);
}
if ($type == "detail") {
    $id = $_GET['id'];
    getPost($id, $db);
}
if ($type == "give") {
    $id = $_GET['id'];
    giveAdvice($id, $db);
}
if ($type == "getadvice") {
    $id = $_GET['id'];
    getAdvice($id, $db);
}
function getAdvice($postid, $db)
{
Exemple #2
0
function setTopQuestion($postid)
{
    if (isTopQuestion($postid)) {
        return 1;
    }
    unsetTopQuestion(getTopQuestionid());
    if (getPostType($postid) == "question") {
        $arr = qa_db_query_sub("UPDATE ^posts set istop=1 where postid = \$ and `type`='Q'", $postid);
        return $arr;
    } else {
        return null;
    }
}