All pastes #822794 Raw Edit

Stuff

public text v1 · immutable
·published 2007-12-18 23:31 UTC
rendered paste body
    function db_to_superglobal($superglobal, $table, $cond)
    {
        if ( ($superglobal == "GET" || $superglobal == "POST" || $superglobal != "SESSION") && !empty($table) )
        {
            if ( !empty($cond) ) $wheretxt = " WHERE " . $cond;
            $sql = "SELECT * FROM " . $table . $wheretxt;
            $result = mysql_query($sql);
            $rec = mysql_fetch_assoc($result);
            foreach ( $rec as $key=>$val )
            {
                ${'_' . $superglobal}[$key] = $val;
            }
        }
    }