• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP error_database函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中error_database函数的典型用法代码示例。如果您正苦于以下问题:PHP error_database函数的具体用法?PHP error_database怎么用?PHP error_database使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了error_database函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: login

function login($username, $password)
{
    global $pdo;
    if (isset($_SESSION['userid']) && $username == $_SESSION['userid']) {
        return TRUE;
    }
    if ($pdo == null) {
        open_database();
    }
    $stmt = $pdo->prepare("SELECT * FROM users WHERE login=?");
    if (!$stmt->execute(array($username))) {
        die('Invalid query : [' . error_database() . ']' . $pdo->errorInfo());
    }
    $row = $stmt->fetch(PDO::FETCH_ASSOC);
    $stmt->closeCursor();
    if (!isset($row['salt'])) {
        return FALSE;
    }
    $digest = encrypt_password($password, $row['salt']);
    if ($digest == $row['crypted_password']) {
        $_SESSION['userid'] = $row['id'];
        $_SESSION['username'] = $row['name'];
        $_SESSION['useraccess'] = $row['access_level'];
        $_SESSION['userpageaccess'] = $row['page_access_level'];
        return TRUE;
    } else {
        return FALSE;
    }
}
开发者ID:justinmcgrath,项目名称:pecan,代码行数:29,代码来源:common.php


示例2: allSites

function allSites()
{
    global $pdo;
    // Select all the rows in the markers table
    $result = $pdo->query("SELECT id, sitename, city, country, ST_X(ST_CENTROID(geometry)) AS lon, ST_Y(ST_CENTROID(geometry)) AS lat FROM sites;");
    if (!$result) {
        die('Invalid query: ' . error_database());
    }
    // Iterate through the rows, adding XML nodes for each
    while ($row = @$result->fetch(PDO::FETCH_ASSOC)) {
        addNode($row);
    }
}
开发者ID:ebimodeling,项目名称:pecan,代码行数:13,代码来源:sites.php


示例3: die

if (isset($_REQUEST['hostname'])) {
    $hostname = $_REQUEST['hostname'];
}
$modelid = "";
if (isset($_REQUEST['modelid'])) {
    $modelid = $_REQUEST['modelid'];
}
$siteid = "";
if (isset($_REQUEST['siteid'])) {
    $siteid = $_REQUEST['siteid'];
}
// get hosts
$query = "SELECT id, hostname FROM machines ORDER BY hostname";
$result = $pdo->query($query);
if (!$result) {
    die('Invalid query: ' . error_database());
}
$hosts = "";
while ($row = @$result->fetch(PDO::FETCH_ASSOC)) {
    if (in_array($row['hostname'], $hostlist)) {
        if ($hostname == $row['hostname']) {
            $hosts = "{$hosts}<option selected data-id='{$row['id']}'>{$row['hostname']}</option>\n";
        } else {
            $hosts = "{$hosts}<option data-id='{$row['id']}'>{$row['hostname']}</option>\n";
        }
    }
}
?>
<!DOCTYPE html>
<html>
<head>
开发者ID:andydawson,项目名称:pecan,代码行数:31,代码来源:02-modelsite.php


示例4: die

$q->bindParam(':startdate', $startdate, PDO::PARAM_STR);
$q->bindParam(':enddate', $enddate, PDO::PARAM_STR);
$q->bindParam(':params', $params, PDO::PARAM_STR);
$q->bindParam(':advanced_edit', $advanced_edit, PDO::PARAM_INT);
if ($q->execute() === FALSE) {
    die('Can\'t insert workflow : ' . error_database());
}
if ($db_bety_type == 'pgsql') {
    $workflowid = $pdo->lastInsertId('workflows_id_seq');
} else {
    $workflowid = $pdo->lastInsertId();
}
# folders
$folder = $output_folder . DIRECTORY_SEPARATOR . 'PEcAn_' . $workflowid;
if ($pdo->query("UPDATE workflows SET folder='{$folder}' WHERE id={$workflowid}") === FALSE) {
    die('Can\'t update workflow : ' . error_database());
}
# if on localhost replace with localhost
if ($hostname == $fqdn) {
    $hostname = "localhost";
}
# create pecan.xml
if (!mkdir($folder)) {
    die('Can\'t create output folder');
}
$fh = fopen($folder . DIRECTORY_SEPARATOR . "pecan.xml", 'w');
fwrite($fh, "<?xml version=\"1.0\"?>" . PHP_EOL);
fwrite($fh, "<pecan>" . PHP_EOL);
fwrite($fh, "  <outdir>{$folder}</outdir>" . PHP_EOL);
fwrite($fh, "  <database>" . PHP_EOL);
fwrite($fh, "    <bety>" . PHP_EOL);
开发者ID:ebimodeling,项目名称:pecan,代码行数:31,代码来源:04-runpecan.php


示例5: print_select_options

function print_select_options($name, $myid, $readonly, $query)
{
    global $pdo;
    if ($readonly) {
        if ($myid == "") {
            $query .= " WHERE id=-1";
        } else {
            $query .= " WHERE id={$myid}";
        }
    }
    $result = $pdo->query($query . " ORDER BY name");
    if (!$result) {
        die('Invalid query "' . $query . '" : [' . error_database() . ']' . error_database());
    }
    if ($readonly) {
        print "<select name=\"{$name}\" disabled>\n";
    } else {
        print "<select name=\"{$name}\">\n";
    }
    $html = "";
    $foundit = false;
    while ($row = @$result->fetch(PDO::FETCH_ASSOC)) {
        $name = $row['name'];
        if ($name == "") {
            $name = "NO NAME {$row['id']}";
        }
        if ($myid == $row['id']) {
            $html .= "<option value=\"{$row['id']}\" selected>{$name}</option>\n";
            $foundit = true;
        } else {
            if (!$readonly) {
                $html .= "<option value=\"{$row['id']}\">{$name}</option>\n";
            }
        }
    }
    if (!$foundit) {
        if ($myid == "" || $myid == "-1") {
            $html = "<option value=\"-1\" selected>Please make a selection</option>\n" . $html;
        } else {
            $html = "<option value=\"-1\" selected>No item with this id {$myid}</option>\n" . $html;
        }
    }
    print $html;
    print "</select>\n";
    $result->closeCursor();
}
开发者ID:ebimodeling,项目名称:pecan,代码行数:46,代码来源:common.php


示例6: get_sites

function get_sites()
{
    global $pdo, $dom, $root, $hostlist;
    global $earth, $met, $host, $model, $sitegroup;
    $parnode = $root->appendChild($dom->createElement("markers"));
    // 1. Get a list of all sites we have
    $subs = array();
    $where = "";
    $query = "SELECT sites.id, sites.sitename, sites.city, sites.country, ST_X(ST_CENTROID(sites.geometry)) AS lon, ST_Y(ST_CENTROID(sites.geometry)) AS lat FROM sites";
    if ($sitegroup) {
        $query .= " INNER JOIN sitegroups_sites ON sitegroups_sites.site_id=sites.id";
        $where .= $where == "" ? " WHERE" : " AND";
        $where .= " sitegroups_sites.sitegroup_id=?";
        $subs[] = $sitegroup;
    }
    $query .= $where;
    $stmt = $pdo->prepare($query);
    if (!$stmt->execute($subs)) {
        die('Invalid query: ' . error_database());
    }
    $sites = array();
    while ($row = @$stmt->fetch(PDO::FETCH_ASSOC)) {
        $row['format_id'] = array();
        $sites[$row['id']] = $row;
    }
    // in case of model we will need to filter those sites that can never be run
    if ($model) {
        // 1. Get list of all formats for each site
        $subs = array();
        $query = "SELECT DISTINCT sites.id, format_id FROM sites";
        $query .= " INNER JOIN inputs ON sites.id=inputs.site_id";
        $query .= " INNER JOIN dbfiles ON inputs.id=dbfiles.container_id";
        $where = " AND dbfiles.container_type='Input'";
        if ($sitegroup) {
            $query .= " INNER JOIN sitegroups_sites ON sitegroups_sites.site_id=sites.id";
            $where .= " AND sitegroups_sites.sitegroup_id=?";
            $subs[] = $sitegroup;
        }
        if ($host) {
            $query .= " INNER JOIN machines ON dbfiles.machine_id=machines.id";
            $where .= " AND machines.hostname=?";
            $subs[] = $host;
        }
        $query .= $where . " GROUP BY sites.id, format_id;";
        $stmt = $pdo->prepare($query);
        if (!$stmt->execute($subs)) {
            die('Invalid query: ' . error_database());
        }
        while ($row = @$stmt->fetch(PDO::FETCH_ASSOC)) {
            $sites[$row['id']]['format_id'][] = $row['format_id'];
        }
        $stmt->closeCursor();
        // 2. Find all formats that are in world
        $subs = array();
        $query = "SELECT DISTINCT format_id FROM inputs";
        $query .= " INNER JOIN dbfiles ON inputs.id=dbfiles.container_id";
        $where = " WHERE inputs.site_id={$earth} AND dbfiles.container_type='Input'";
        if ($host) {
            $query .= " INNER JOIN machines ON dbfiles.machine_id=machines.id";
            $where .= " AND machines.hostname=?";
            $subs[] = $host;
        }
        $query .= $where . " GROUP BY format_id;";
        $stmt = $pdo->prepare($query);
        if (!$stmt->execute($subs)) {
            die('Invalid query: ' . error_database());
        }
        while ($row = @$stmt->fetch(PDO::FETCH_ASSOC)) {
            foreach ($sites as &$site) {
                $site['format_id'][] = $row['format_id'];
            }
        }
        $stmt->closeCursor();
        // 3. Find all conversions possible
        if (isset($_REQUEST['conversion'])) {
            // Check for Download -> CF
            foreach ($sites as &$site) {
                if (!in_array($met['CF'], $site['format_id'])) {
                    $site['format_id'][] = $met['CF'];
                }
            }
            // Check for CF -> model
            $stmt = $pdo->prepare("SELECT modeltypes.name FROM modeltypes, models" . " WHERE modeltypes.id=models.modeltype_id" . " AND models.id=?;");
            if (!$stmt->execute(array($model))) {
                die('Invalid query: ' . error_database());
            }
            $modeltypes = $stmt->fetchAll(PDO::FETCH_COLUMN, 0);
            $stmt->closeCursor();
            foreach ($sites as &$site) {
                if (in_array($met['CF'], $site['format_id'])) {
                    foreach ($modeltypes as $mt) {
                        if (array_key_exists($mt, $met)) {
                            $site['format_id'][] = $met[$mt];
                        }
                    }
                }
            }
        }
        // 4. Get list of all formats needed for model
        $stmt = $pdo->prepare("SELECT format_id FROM modeltypes_formats, models" . " WHERE modeltypes_formats.modeltype_id=models.modeltype_id" . " AND modeltypes_formats.required = true" . " AND models.id=?;");
//.........这里部分代码省略.........
开发者ID:jsimkins2,项目名称:pecan,代码行数:101,代码来源:hostmodelinfo.php



注:本文中的error_database函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP error_exit函数代码示例发布时间:2022-05-15
下一篇:
PHP error_code函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap