Example #1
0
function SelectRevisions($id)
{
    include 'connect/connect.php';
    $sql = "SELECT revisions FROM tips_articles WHERE id=" . sip($id);
    $temp = $conn->query($sql);
    //the variable $conn connect with file connect.php
    $row = $temp->fetch_array();
    $result = $row[0];
    $temp->close();
    // free memory
    $conn->close();
    // close connect
    return $result;
}
Example #2
0
function GetArticle($title_id)
{
    include 'connect/connect.php';
    $sql = "SELECT id, title, author,  article, updated_up, revisions FROM tips_articles  WHERE id =" . sip($title_id);
    $temp = $conn->query($sql);
    //the variable $conn connect with file connect.php
    $number = $temp->num_rows;
    $result = array();
    if ($number > 0) {
        for ($i = 0; $i < $number; $i++) {
            $result[$i] = $temp->fetch_array();
        }
    } else {
        die("SQL: Select is not successful: GetArticle");
    }
    $temp->close();
    // free memory
    $conn->close();
    // close connect
    return $result;
}