示例#1
0
function jsgetArray($strsql)
{
    $columns = '';
    $types = '';
    $values = '';
    $results = $GLOBALS['db']->query($strsql);
    if (!$results) {
        $err = $GLOBALS['db']->errorInfo();
        return "<hr>{$strsql}<hr>Error: " . $err[2];
    }
    for ($col = 0; $col < $results->columnCount(); $col++) {
        $meta = $results->getColumnMeta($col);
        $columns = $columns . "'" . $meta['name'] . "',";
        $types = $types . "'" . $meta['native_type'] . "',";
    }
    while ($row = $results->fetch()) {
        $values = $values . '[';
        for ($col = 0; $col < $results->columnCount(); $col++) {
            $meta = $results->getColumnMeta($col);
            if ($meta['native_type'] == 'string' && $meta['name'] != 'image') {
                $values = "{$values}'" . base64_encode(utf8_decode($row[$col])) . "',";
            } else {
                $values = "{$values}'" . base64_encode($row[$col]) . "',";
            }
        }
        $values = offLast($values) . '],';
    }
    if (strlen($types) < 4) {
        $types = "'',";
    }
    if (strlen($values) < 4) {
        $values = '[' . str_repeat('\'LQ==\',', $results->columnCount()) . '],';
    }
    $columns = 'columns:[' . offLast($columns) . ']';
    $types = 'types:[' . offLast($types) . ']';
    $values = 'values:[' . offLast($values) . ']';
    $values = preg_replace("/\r?\n/", "\\n", $values);
    return '{' . "{$columns},{$types},{$values}" . '}';
}
示例#2
0
    $strsql = "INSERT INTO [{$table}] ({$buscaPor}) VALUES('-');";
    $results = $GLOBALS['db']->exec($strsql);
    if (!$results) {
        $err = $GLOBALS['db']->errorInfo();
        echo '<hr>' . $strsql . '<hr>Error: ' . $err[2];
        exit;
    }
    $_SESSION[$keyMaster] = $GLOBALS['db']->lastInsertId();
}
if (isset($editsql)) {
    $strsql = $editsql;
} else {
    $strsql = "select * from {$table} where {$keyMaster}=" . $_SESSION[$keyMaster];
}
if (right($strsql, 2) == '=0') {
    $strsql = offLast($strsql) . $_SESSION[$keyMaster];
}
?>
<html>

<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<meta content="es" http-equiv="Content-Language">
<link href="../../../cgi_bin/jss/jss.css" rel="stylesheet" type="text/css">
<script src="../../../cgi_bin/jss/jss.js" type="text/javascript"></script>
<script src="../../../cgi_bin/jss/jssColor.js" type="text/javascript"></script>
<title>tableForm</title>
<base target="_self">
<script type="text/javascript">
var puntero;
jss.Init=function(){