Esempio n. 1
0
function checkForError($query = null)
{
    if (mysql_error()) {
        // echo mysql_error();
        // error_reporting(0);
        // warning_reporting(0);
        logSQLError($query, mysql_error());
        // echo mysql_error();
        die;
    }
}
Esempio n. 2
0
function deleteMovieDate($date)
{
    $db = getDBConnection();
    //date is always unique
    $query = "DELETE from `moviedates` WHERE Date = :Date";
    $statement = $db->prepare($query);
    $statement->bindValue(':Date', $date);
    $success = $statement->execute();
    $statement->closeCursor();
    if ($success) {
        return $statement->rowCount();
    } else {
        logSQLError($statement->errorInfo());
    }
}
Esempio n. 3
0
function updateNewsItem($newsID, $headline, $content, $userID)
{
    $db = getDBConnection();
    $query = 'UPDATE news SET Headline = :Headline, Content = :Content, EditUserID = :EditUserID,
             DateEdited = NOW() ' . 'WHERE NewsID = :NewsID';
    $statement = $db->prepare($query);
    $statement->bindValue(':Headline', $headline);
    $statement->bindValue(':Content', $content);
    $statement->bindValue(':EditUserID', $userID);
    $statement->bindValue(':NewsID', $newsID);
    //$statement->bindValue(':YouTubeLink', $youTube);
    $success = $statement->execute();
    $statement->closeCursor();
    if ($success) {
        return $statement->rowCount();
        // Number of rows affected
    } else {
        logSQLError($statement->errorInfo());
        // Log error to debug
    }
}
Esempio n. 4
0
function deleteRole($RoleID)
{
    try {
        $db = getDBConnection();
        $query = "DELETE FROM roles WHERE RoleID = :RoleID";
        $statement = $db->prepare($query);
        $statement->bindValue(':RoleID', $RoleID);
        $success = $statement->execute();
        $statement->closeCursor();
        if ($success) {
            return $statement->rowCount();
            // Number of rows affected
        } else {
            logSQLError($statement->errorInfo());
            // Log error
        }
    } catch (PDOException $e) {
        displayDBError($e->getMessage());
    }
}
Esempio n. 5
0
function updateAppleItem($appleID, $title)
{
    $db = getDBConnection();
    $query = 'UPDATE apple SET Title = :Title ' . 'WHERE AppleID = :AppleID';
    $statement = $db->prepare($query);
    $statement->bindValue(':AppleID', $appleID);
    $statement->bindValue(':Title', $title);
    $success = $statement->execute();
    $statement->closeCursor();
    if ($success) {
        return $statement->rowCount();
        // Number of rows affected
    } else {
        logSQLError($statement->errorInfo());
        // Log error to debug
    }
}