当前位置: 首页>>代码示例>>PHP>>正文


PHP db::error方法代码示例

本文整理汇总了PHP中db::error方法的典型用法代码示例。如果您正苦于以下问题:PHP db::error方法的具体用法?PHP db::error怎么用?PHP db::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在db的用法示例。


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

示例1: __construct

 public function __construct($dbname, $dbuser, $dbpass, $error = array(NULL, NULL))
 {
     self::$error = new error($error[0], $error[1]);
     $this->json = new Services_JSON();
     $fp = fopen(CWD . "users", "r");
     while (fscanf($fp, "%s\n", $hash)) {
         if ($hash == md5($dbuser . $dbpass)) {
             self::$access = 1;
             break;
         }
         if (self::$access == 0) {
             $this->nouser($dbuser);
         }
     }
     if (self::$access == 1) {
         if (!is_dir(CWD . $dbname)) {
             if (!defined('ADMIN') || ADMIN == 0) {
                 $this->nodb($dbname);
             } else {
                 if (ADMIN == 1) {
                     $this->createdb($dbname);
                 }
             }
         } else {
             self::$db = CWD . $dbname . "/";
         }
     }
 }
开发者ID:pksunkara,项目名称:pdql,代码行数:28,代码来源:db.php

示例2: getsession

<button onclick="location='/44/login/logout.php'">登出</button>
<?php 
echo getsession("account") . " #" . getsession("id") . " ~" . getsession("name");
?>
<br>
<a href=".">預約單/取消</a> | <a href="search.php">查詢/預約</a> | <a href="view.php">會議室瀏覽</a><br>
<br>
<fieldset><legend>預約單</legend>
<table border=2>
<tr><th><a href=".?sort=0">預約單編號</a></th><th><a href=".?sort=1">使用日期</a><br>(年/月/日)</th><th>使用時段</th><th>會議室編號</th><th>借用人</th><th></th></tr>
<?php 
$A = new db();
$B = new db();
switch (get("sort")) {
    case 0:
        $A->query("select * from reserves where name='" . getsession("id") . "' order by serial") ?: $A->error();
        break;
    case 1:
        $A->query("select * from reserves where name='" . getsession('id') . "' order by date") ?: $A->error();
        break;
}
if ($A->count() > 0) {
    while ($A->fetch()) {
        ?>
<tr>
<td><?php 
        echo $A->element("serial");
        ?>
</td>
<td><?php 
        echo str_replace("-", "/", $A->element("date"));
开发者ID:awei0905,项目名称:Elimination-Series,代码行数:31,代码来源:index.php

示例3: time

<?php

include_once 'phplib/base.php';
if (!db::connect()) {
    echo "Database connection failed, cannot continue. ";
} else {
    $timestamp = time();
    $username = getUsername();
    $range_start = db::escape($_POST['range_start']);
    $range_end = db::escape($_POST['range_end']);
    $report_id = generateMeetingNotesID($range_start, $range_end);
    $notes = db::escape($_POST['weeklynotes']);
    $query = "INSERT INTO meeting_notes (report_id, range_start, range_end, timestamp, user, notes) VALUES ('{$report_id}', '{$range_start}', '{$range_end}', '{$timestamp}', '{$username}', '{$notes}')";
    if (!db::query($query)) {
        echo "Database update failed, error: " . db::error();
    } else {
        Header("Location: {$ROOT_URL}/index.php?meeting_done=hellyeah");
    }
}
开发者ID:arhaa,项目名称:opsweekly,代码行数:19,代码来源:add_meeting_notes.php

示例4: post

<?php

include $_SERVER["DOCUMENT_ROOT"] . "/44/func/mysql.php";
isroot();
$id = post("id");
$password = post("password");
$name = post("name");
$question = post("question");
$answer = post("answer");
$A = new db();
if (post("delete")) {
    $A->query("delete from accounts where id = '{$id}'") ?: $A->error();
    echo "已刪除";
    redirect("/admin/");
} else {
    if (post("save")) {
        $A->query("update accounts set password='{$password}', name='{$name}', question='{$question}', answer='{$answer}' where id='{$id}'") ?: $A->error();
        echo "已更新";
        redirect("/admin/");
    } else {
        echo "錯誤!!";
    }
}
开发者ID:awei0905,项目名称:Elimination-Series,代码行数:23,代码来源:edituser.php

示例5: post

<?php

include $_SERVER["DOCUMENT_ROOT"] . "/44/func/mysql.php";
ismember();
if (post("delete")) {
    $id = post("id");
    $A = new db();
    $A->query("delete from reserves where id = '{$id}'") ?: $A->error();
    echo "已刪除";
    redirect("/member/.");
} else {
    echo "錯誤!!";
}
开发者ID:awei0905,项目名称:Elimination-Series,代码行数:13,代码来源:editreserve.php

示例6: redirect

        }
        $A->query("update floors set name='{$name}',r1='{$status['0']}',r2='{$status['1']}',r3='{$status['2']}',r4='{$status['3']}',r5='{$status['4']}',r6='{$status['5']}' where id = '{$id}'") ?: $A->error();
        echo "已更新";
    }
} else {
    if (post("delete")) {
        if (post("N")) {
            redirect("/admin/floor.php");
            die("已取消操作!!");
        }
        $id = post("id");
        $A = new db();
        $B = new db();
        $msg = '0';
        if (post("Y")) {
            $A->query("delete from floors where id = '{$id}'") ?: $A->error();
            $B->query("delete from reserves where floor = '{$id}'");
            redirect("/admin/floor.php");
            die("已刪除");
        }
        $B->query("select * from reserves where floor='{$id}'");
        if ($B->count() > 0) {
            while ($B->fetch()) {
                if ($msg == '0') {
                    ?>
                <table border=2>
					<tr>
						<th>預約單編號</th><th>使用日期<br>(年/月/日)</th><th>使用時段</th><th>會議室號碼</th><th>借用人</th>
					</tr>
                <?php 
                }
开发者ID:awei0905,项目名称:Elimination-Series,代码行数:31,代码来源:editfloor.php

示例7: redirect

<?php

include $_SERVER["DOCUMENT_ROOT"] . "/44/func/mysql.php";
if (post("your_answer") != post("correct_answer")) {
    echo "驗證碼錯誤!";
    session_destroy();
    redirect("/login");
    die;
}
if (post("account") == "admin" && post("password") == "1234") {
    setsession("account", "admin");
    setsession("id", "-1");
    redirect("/admin");
    echo "請稍後...";
} else {
    $A = new db();
    $A->query("select * from accounts where account = '" . post("account") . "' and password = '" . post("password") . "'") ?: $A->error();
    if ($A->fetch()) {
        setsession("account", post("account"));
        setsession("id", $A->element("id"));
        setsession("name", $A->element("name"));
        echo "請稍後...";
        redirect("/member");
    } else {
        echo "帳號密碼錯誤!";
        redirect("/login");
    }
}
开发者ID:awei0905,项目名称:Elimination-Series,代码行数:28,代码来源:redirect.php

示例8: implode

        if (count($insert_values) > 0) {
            $insert_values_string = implode(', ', $insert_values);
            $insert_query = "INSERT INTO oncall_weekly (alert_id, range_start, range_end, timestamp, hostname, service, state, contact, output, tag, sleep_state, mtts, sleep_level, sleep_confidence, notes) VALUES {$insert_values_string}";
            if (!db::query($insert_query)) {
                echo "Database insert failed, error: " . db::error();
                logline("Database insert failed, error: " . db::error());
            }
        }
        // NOTE: This doesn't solve for entries that are already duplicated.
        // But this should prevent future entries from being duplicated.
        if (count($update_values) > 0) {
            foreach ($update_values as $update_hash) {
                $set_columns = array();
                foreach ($update_hash as $column => $value) {
                    array_push($set_columns, "{$column}='{$value}'");
                }
                $update_values_string = implode(', ', $set_columns);
                $update_query = "UPDATE oncall_weekly SET {$update_values_string} WHERE alert_id='{$update_hash['alert_id']}'";
                if (!db::query($update_query)) {
                    echo "Database update failed, error: " . db::error();
                    logline("Database update failed, error: " . db::error());
                }
            }
        }
        logline("Everything worked great, redirecting the user with success");
        Header('Location: add.php?oncall_succ=hellyeah');
    } else {
        logline("We didn't find any notifications to process, redirect user back to add page");
        Header('Location: add.php');
    }
}
开发者ID:afolson,项目名称:opsweekly,代码行数:31,代码来源:add_oncall_weekly.php

示例9: db

    <input type="hidden" name="step" value="3">
    </form></td>
    </tr>
    </table>
    </fieldset>
    <?php 
        break;
    case 3:
        $A = new db();
        $serial = rand(999999, 9999999);
        $date = get("date");
        $section = get("section");
        $floor = get("floor");
        $room = get("room");
        $name = getsession("id");
        $A->query("insert into reserves values ('','{$serial}','{$date}','{$section}','{$floor}','{$room}','{$name}')") ?: $A->error();
        ?>
    <fieldset><legend>已新增以下預約單</legend>
     <table border=2>
    <tr><th>使用日期<br>(年/月/日)</th><th>使用時段</th><th>會議室號碼</th></tr>
    <tr>
    <td><?php 
        echo str_replace("/", "-", get("date"));
        ?>
</td>
    <td><?php 
        echo section(get("section"));
        ?>
</td>
    <td><a href="search.php?step=4&floor=<?php 
        echo get("floor");
开发者ID:awei0905,项目名称:Elimination-Series,代码行数:31,代码来源:search.php

示例10: post

<?php

include $_SERVER["DOCUMENT_ROOT"] . "/44/func/mysql.php";
isroot();
$name = post("name");
$A = new db();
$A->query("insert into floors values('','{$name}',1,1,1,1,1,1)") ?: $A->error();
echo "已新增";
redirect("/admin/floor.php");
开发者ID:awei0905,项目名称:Elimination-Series,代码行数:9,代码来源:addfloor.php

示例11: die

<?php

include $_SERVER["DOCUMENT_ROOT"] . "/44/func/mysql.php";
isroot();
if (!post("account")) {
    die("錯誤!!");
}
$account = post("account");
$password = post("password");
$name = post("name");
$question = post("question");
$answer = post("answer");
$A = new db();
$A->query("select * from accounts where account='{$account}'") ?: $A->error();
if ($A->fetch()) {
    echo "此帳號已存在!!";
} else {
    $A->query("insert into accounts values ('','{$account}','{$password}','{$name}','{$question}','{$answer}')") ?: $A->error();
    echo "已新增";
}
redirect("/admin/");
开发者ID:awei0905,项目名称:Elimination-Series,代码行数:21,代码来源:adduser.php


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