예제 #1
0
파일: dbfuncs.php 프로젝트: jrising/console
function dbgetarray()
{
    $output = array();
    $args = func_get_args();
    $result = call_user_func_array('dbquery', $args);
    $query = array_shift($args);
    // this only applies to SELECT queries!
    if (preg_match('/^SELECT/i', $query)) {
        while ($result && ($row = dbfetch($result, DB_NUM))) {
            if (count($row) == 1) {
                // use integer keys
                $output[] = $row[0];
            } else {
                if (count($row) == 2) {
                    // use first column keys
                    $output[$row[0]] = $row[1];
                } else {
                    // use integer keys and array values
                    $output[] = $row;
                }
            }
        }
        dbfree($result);
    } else {
        //EWarning(EC_REALS_DATABASE, "dbgetarray called with non-SELECT query!", "Non-select query");
    }
    return $output;
}
예제 #2
0
    if ($cnt > 0) {
        $queue = dbarray($qresult);
        echo loca("NAME_" . $queue['tech_id']);
    } else {
        echo "";
    }
    dbfree($qresult);
    echo "</center></th>\n";
    if ($i == $num - 1) {
        echo "</tr>\n\n";
    } else {
        if ($i % 2 != 0) {
            echo "</tr>\n\n";
        }
    }
    dbfree($planet);
}
echo "<tr></tr>\n</table>\n</th>\n\n";
if ($GlobalUser['score1'] < 0) {
    $score = 0;
} else {
    $score = nicenum(floor($GlobalUser['score1'] / 1000));
}
// Параметры планеты
echo "<tr><th> " . va(loca("OVERVIEW_DIAM"), nicenum($aktplanet['diameter'])) . "     " . va(loca("OVERVIEW_FIELDS"), $aktplanet['fields'], $aktplanet['maxfields']) . "   </th></tr>\n";
echo "<tr><th> " . va(loca("OVERVIEW_TEMP"), $aktplanet['temp'], $aktplanet['temp'] + 40) . "   \n";
echo "<tr><th> " . va(loca("OVERVIEW_COORD"), "<a href=\"index.php?page=galaxy&galaxy=" . $aktplanet['g'] . "&system=" . $aktplanet['s'] . "&position=" . $aktplanet['p'] . "&session={$session}\" >[" . $aktplanet['g'] . ":" . $aktplanet['s'] . ":" . $aktplanet['p'] . "]</a>") . "\n";
echo "<tr><th> " . va(loca("OVERVIEW_RANK"), $score, "<a href='index.php?page=statistics&session={$session}&start=" . (floor($GlobalUser['place1'] / 100) * 100 + 1) . "'>" . nicenum($GlobalUser['place1']) . "</a>", nicenum($uni['usercount'])) . "     \n";
echo "</table>\n<br><br><br><br><br>\n";
echo "</center>\n";
echo "</div>\n";