function getCommentsRated()
{
    Gen_fun::error_CHK($_GET, array('userLoggedInKey'));
    //----------------------------------------------------------
    $queryString = "SELECT " . Constants::CLM_COMMENTKEY_ID;
    $queryString .= "," . Constants::CLM_JUSTIFY_ID;
    $queryString .= "," . Constants::CLM_LEVEL_ID;
    $queryString .= "," . Constants::CLM_MATURITYKEY_ID;
    $queryString .= " FROM " . Constants::TBL_MATURITY_RATED_ID;
    $queryString .= " INNER JOIN " . Constants::TBL_MATURITY_LEVELS_ID;
    $queryString .= " ON " . Constants::TBL_MATURITY_RATED_ID . "." . Constants::CLM_MATURITYKEY_ID . "=" . Constants::TBL_MATURITY_LEVELS_ID . "." . Constants::CLM_KEY_ID;
    $queryString .= " WHERE " . Constants::CLM_USERKEY_ID . " =" . $_GET['userLoggedInKey'];
    $queryString .= " AND " . Constants::CLM_DEACTIVATED_ID . "=0";
    $result = mysql_query($queryString);
    //----------------------------------------------------------
    $newArray = array();
    //----------------------------------------------------------
    if ($result > 0) {
        //------------------------------------------------------
        while ($row = mysql_fetch_assoc($result)) {
            array_push($newArray, $row);
        }
        //------------------------------------------------------
    }
    return $newArray;
}
Ejemplo n.º 2
0
function dbConnect()
{
    Gen_fun::error_CHK($_GET, array('dataBase_id'));
    //----------------------------------------------------------
    $conn = mysql_connect(Constants::HOST, Constants::USER, Constants::PASS) or die('Could not connect to mysql server.');
    //----------------------------------------------------------
    mysql_select_db($_GET['dataBase_id'], $conn) or die('Could not connect to mysql database.');
    //----------------------------------------------------------
    return $conn;
}
Ejemplo n.º 3
0
function update_ratingRatio($ratio)
{
    //----------------------------------------------------------
    Gen_fun::error_CHK($_GET, array('commentKey'));
    //----------------------------------------------------------
    $queryString = "UPDATE " . Constants::TBL_COMMENTS_ID;
    $queryString .= " SET " . Constants::CLM_MATURITY_RATIO_ID . "=" . $ratio;
    $queryString .= ", " . Constants::CLM_MATURITYKEY_ID . "=" . floor($ratio);
    $queryString .= " WHERE " . Constants::CLM_KEY_ID . "=" . $_GET['commentKey'];
    //------------------------------------------------------
    mysql_query($queryString) or die("update_ratingRatio: query did not go through " . $queryString);
}