Location: PHPKode > projects > PHPEcho CMS > kernel/mysqlutils.inc.php
<?php
/*  +--------------------------------------------
*   |
*   |     Product:       PHPEchoCMS
*   |     Author:        Tigran Abrahamyan
*   |     License:       GPL
*   |     Last updated:  23.01.07
*   |     For version:   1.2  
*   |     Desc:          Functions for working with mySQL database.
*   |        
*   +--------------------------------------------
*/

@mysql_connect ($cfg_db_host , $cfg_db_user , $cfg_db_pass) or die("MySQL Error. Please check mysql connection configs.");
@mysql_select_db ($cfg_db_name) or die("MySQL Error. Please check database and database configs.");

// -------------------
// query() function.
// -------------------

function query ($query, $v)
{
    $query = mysql_query( $query );
    switch ( $v )
    {
        case 1:
            $result = $query;
            break;
        case 2:
            $result = mysql_result ($query, 0);
            break;
        case 3:
            $result = mysql_num_rows ($query);
            break;
        case 4:
            $result = mysql_fetch_array ($query);
            break;
    }
    
    return $result;
}

function query_slash ($query, $v)
{
    $result = query ($query, $v);
    $result = get_magic_quotes_gpc () ? $result : @addslashes ($result);
    return $result;
}
?>
Return current item: PHPEcho CMS