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


PHP Err函数代码示例

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


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

示例1: testdb

function testdb(&$db, $createtab = "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)")
{
    global $ADODB_vers, $ADODB_CACHE_DIR, $ADODB_FETCH_MODE, $ADODB_COUNTRECS;
    //adodb_pr($db);
    ?>
	<form method=GET>
	</p>
	<table width=100% ><tr><td bgcolor=beige>&nbsp;</td></tr></table>
	</p>
<?php 
    $create = false;
    /*$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
    	
    	$rs = $db->Execute('select lastname,firstname,lastname,id from ADOXYZ');
    	$arr = $rs->GetAssoc();
    	echo "<pre>";print_r($arr);
    	die();*/
    if (!$db) {
        die("testdb: database not inited");
    }
    global $EXECS, $CACHED;
    $EXECS = 0;
    $CACHED = 0;
    //$db->Execute("drop table adodb_logsql");
    if (rand() % 3 == 0) {
        @$db->Execute("delete from adodb_logsql");
    }
    $db->debug = 1;
    $db->fnExecute = 'CountExecs';
    $db->fnCacheExecute = 'CountCachedExecs';
    if (empty($_GET['nolog'])) {
        echo "<h3>SQL Logging enabled</h3>";
        $db->LogSQL();
        /*
        		$sql =
        "SELECT t1.sid, t1.sid, t1.title, t1.hometext, t1.notes, t1.aid, t1.informant, 
        t2.url, t2.email, t1.catid, t3.title, t1.topic, t4.topicname, t4.topicimage, 
        t4.topictext, t1.score, t1.ratings, t1.counter, t1.comments, t1.acomm 
        FROM `nuke_stories` `t1`, `nuke_authors` `t2`, `nuke_stories_cat` `t3`, `nuke_topics` `t4` 
        	WHERE ((t2.aid=t1.aid) AND (t3.catid=t1.catid) AND (t4.topicid=t1.topic) 
        	AND ((t1.alanguage='german') OR (t1.alanguage='')) AND (t1.ihome='0')) 
        	ORDER BY t1.time DESC";
        		$db->SelectLimit($sql);
        		echo $db->ErrorMsg();*/
    }
    $ADODB_CACHE_DIR = dirname(TempNam('/tmp', 'testadodb'));
    $db->debug = false;
    //print $db->UnixTimeStamp('2003-7-22 23:00:00');
    $phpv = phpversion();
    if (defined('ADODB_EXTENSION')) {
        $ext = ' &nbsp; Extension ' . ADODB_EXTENSION . ' installed';
    } else {
        $ext = '';
    }
    print "<h3>ADODB Version: {$ADODB_vers} Host: <i>{$db->host}</i> &nbsp; Database: <i>{$db->database}</i> &nbsp; PHP: {$phpv} {$ext}</h3>";
    flush();
    if (function_exists('date_default_timezone_set')) {
        date_default_timezone_set('Asia/Kuala_Lumpur');
    }
    $arr = $db->ServerInfo();
    print_r($arr);
    echo E_ALL, ' ', E_STRICT, "<br>";
    $e = error_reporting(E_ALL | E_STRICT);
    echo error_reporting(), '<p>';
    flush();
    #$db->debug=1;
    $tt = $db->Time();
    if ($tt == 0) {
        echo '<br><b>$db->Time failed</b>';
    } else {
        echo "<br>db->Time: " . date('d-m-Y H:i:s', $tt);
    }
    echo '<br>';
    echo "Date=", $db->UserDate('2002-04-07'), '<br>';
    print "<i>date1</i> (1969-02-20) = " . $db->DBDate('1969-2-20');
    print "<br><i>date1</i> (1999-02-20) = " . $db->DBDate('1999-2-20');
    print "<br><i>date1.1</i> 1999 = " . $db->DBDate("'1999'");
    print "<br><i>date2</i> (1970-1-2) = " . $db->DBDate(24 * 3600) . "<p>";
    print "<i>ts1</i> (1999-02-20 13:40:50) = " . $db->DBTimeStamp('1999-2-20 1:40:50 pm');
    print "<br><i>ts1.1</i> (1999-02-20 13:40:00) = " . $db->DBTimeStamp('1999-2-20 13:40');
    print "<br><i>ts2</i> (1999-02-20) = " . $db->DBTimeStamp('1999-2-20');
    print "<br><i>ts3</i> (1970-1-2 +/- timezone) = " . $db->DBTimeStamp(24 * 3600);
    print "<br> Fractional TS (1999-2-20 13:40:50.91): " . $db->DBTimeStamp($db->UnixTimeStamp('1999-2-20 13:40:50.91+1'));
    $dd = $db->UnixDate('1999-02-20');
    print "<br>unixdate</i> 1999-02-20 = " . date('Y-m-d', $dd) . "<p>";
    print "<br><i>ts4</i> =" . ($db->UnixTimeStamp("19700101000101") + 8 * 3600);
    print "<br><i>ts5</i> =" . $db->DBTimeStamp($db->UnixTimeStamp("20040110092123"));
    print "<br><i>ts6</i> =" . $db->UserTimeStamp("20040110092123");
    print "<br><i>ts7</i> =" . $db->DBTimeStamp("20040110092123");
    flush();
    // mssql too slow in failing bad connection
    if (false && $db->databaseType != 'mssql') {
        print "<p>Testing bad connection. Ignore following error msgs:<br>";
        $db2 = ADONewConnection();
        $rez = $db2->Connect("bad connection");
        $err = $db2->ErrorMsg();
        print "<i>Error='{$err}'</i></p>";
        if ($rez) {
            print "<b>Cannot check if connection failed.</b> The Connect() function returned true.</p>";
        }
//.........这里部分代码省略.........
开发者ID:mvpphet,项目名称:IntranetPaper,代码行数:101,代码来源:test.php

示例2: testdb

function testdb(&$db, $createtab = "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)")
{
    global $ADODB_vers, $ADODB_CACHE_DIR, $ADODB_FETCH_MODE, $HTTP_GET_VARS, $ADODB_COUNTRECS;
    ?>
	<form method=GET>
	</p>
	<table width=100% ><tr><td bgcolor=beige>&nbsp;</td></tr></table>
	</p>
<?php 
    $create = false;
    global $EXECS, $CACHED;
    $EXECS = 0;
    $CACHED = 0;
    $db->fnExecute = 'CountExecs';
    $db->fnCacheExecute = 'CountCachedExecs';
    $ADODB_CACHE_DIR = dirname(TempNam('/tmp', 'testadodb'));
    $db->debug = false;
    //print $db->UnixTimeStamp('2003-7-22 23:00:00');
    $phpv = phpversion();
    if (defined('ADODB_EXTENSION')) {
        $ext = ' &nbsp; Extension ' . ADODB_EXTENSION . ' installed';
    } else {
        $ext = '';
    }
    print "<h3>ADODB Version: {$ADODB_vers} Host: <i>{$db->host}</i> &nbsp; Database: <i>{$db->database}</i> &nbsp; PHP: {$phpv} {$ext}</h3>";
    $arr = $db->ServerInfo();
    print_r($arr);
    $e = error_reporting(E_ALL - E_WARNING);
    flush();
    print "<i>date1</i> (1969-02-20) = " . $db->DBDate('1969-2-20');
    print "<br><i>date1</i> (1999-02-20) = " . $db->DBDate('1999-2-20');
    print "<br><i>date2</i> (1970-1-2) = " . $db->DBDate(24 * 3600) . "<p>";
    print "<i>ts1</i> (1999-02-20 3:40:50) = " . $db->DBTimeStamp('1999-2-20 13:40:50');
    print "<br><i>ts2</i> (1999-02-20) = " . $db->DBTimeStamp('1999-2-20');
    print "<br><i>ts3</i> (1970-1-2 +/- timezone) = " . $db->DBTimeStamp(24 * 3600);
    print "<br> Fractional TS (1999-2-20 13:40:50.91): " . $db->DBTimeStamp($db->UnixTimeStamp('1999-2-20 13:40:50.91+1'));
    $dd = $db->UnixDate('1999-02-20');
    print "<br>unixdate</i> 1999-02-20 = " . date('Y-m-d', $dd) . "<p>";
    // mssql too slow in failing bad connection
    if ($db->databaseType != 'mssql') {
        print "<p>Testing bad connection. Ignore following error msgs:<br>";
        $db2 = ADONewConnection();
        $rez = $db2->Connect("bad connection");
        $err = $db2->ErrorMsg();
        print "<i>Error='{$err}'</i></p>";
        if ($rez) {
            print "<b>Cannot check if connection failed.</b> The Connect() function returned true.</p>";
        }
    }
    error_reporting($e);
    flush();
    //$ADODB_COUNTRECS=false;
    $rs = $db->Execute('select * from adoxyz order by id');
    //print_r($rs);
    //OCIFetchStatement($rs->_queryID,$rez,0,-1);//,OCI_ASSOC | OCI_FETCHSTATEMENT_BY_ROW);
    //print_r($rez);
    //die();
    if ($rs === false) {
        $create = true;
    } else {
        $rs->Close();
    }
    //if ($db->databaseType !='vfp') $db->Execute("drop table ADOXYZ");
    if ($create) {
        if (false && $db->databaseType == 'ibase') {
            print "<b>Please create the following table for testing:</b></p>{$createtab}</p>";
            return;
        } else {
            $db->debug = 1;
            $e = error_reporting(E_ALL - E_WARNING);
            $db->Execute($createtab);
            error_reporting($e);
        }
    }
    $rs =& $db->Execute("delete from ADOXYZ");
    // some ODBC drivers will fail the drop so we delete
    if ($rs) {
        if (!$rs->EOF) {
            print "<b>Error: </b>RecordSet returned by Execute('delete...') should show EOF</p>";
        }
        $rs->Close();
    } else {
        print "err=" . $db->ErrorMsg();
    }
    print "<p>Test select on empty table</p>";
    $rs =& $db->Execute("select * from ADOXYZ where id=9999");
    if ($rs && !$rs->EOF) {
        print "<b>Error: </b>RecordSet returned by Execute(select...') on empty table should show EOF</p>";
    }
    if ($rs) {
        $rs->Close();
    }
    flush();
    //$db->debug=true;
    print "<p>Testing Commit: ";
    $time = $db->DBDate(time());
    if (!$db->BeginTrans()) {
        print '<b>Transactions not supported</b></p>';
        if ($db->hasTransactions) {
            Err("hasTransactions should be false");
//.........这里部分代码省略.........
开发者ID:alexpagnoni,项目名称:adodb,代码行数:101,代码来源:test.php

示例3: unset

         }
         $sfm_class->sendMail($_SESSION['SFM']['email'], $replySubject, $replyMessage, $replyAddress, $replyBcc);
     }
     $sfm_html = $sfm_class->formDataHtml();
     unset($_SESSION['SFM']);
     include_once $temp_html['completion'];
     break;
 case 'CONFIRM':
     // データ処理と確認
     if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' || preg_match('/secure|ssl/i', $_SERVER['HTTP_HOST']) || $use_ssl == 1) {
         $protcol = 'https://';
     } else {
         $protcol = 'http://';
     }
     if ($_SERVER['HTTP_REFERER'] != $protcol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] && $refCheck) {
         Err('外部から利用は出来ません');
     }
     session_cache_limiter('nocache');
     session_start();
     unset($_SESSION['SFM']);
     $error = $email = '';
     foreach ($_POST as $key => $value) {
         $name = preg_replace('/(.+)_s$/', "\$1", $key);
         if ($value == 'none') {
             $value = '';
         }
         if (is_array($value)) {
             $value = $sfm_class->valueMarge($key, $value, $name_marge);
             if ($value == '__Error_Marge_Data__') {
                 $error = 1;
             }
开发者ID:aim-web-projects,项目名称:ueno-chuoh,代码行数:31,代码来源:index.php

示例4: getpostvar

$action = getpostvar('action');
if (!strlen($action)) {
    $action = NULL;
}
$query = getpostvar('query');
if (!strlen($query)) {
    $query = NULL;
}
query_get_zone($query);
/* If there's a query, but no 'zone' or 'action', set action to 'search' */
if ($query && !$zone && !$action) {
    $action = "search";
}
/* If 'zone' was provided, verify that it exists */
if ($zone && !zone_exists($zone)) {
    Err("<B>Zone {$zone} does not exist.</B>");
}
/* Handle the specified action (if any) */
switch (strtolower($action)) {
    case "search":
        /* Execute top-of-page search query */
        if (!strlen($query)) {
            help_screen();
        }
        zone_editor(query_get_zone($query, 1));
        break;
    case "browse":
        /* Launch the zone browser */
        zone_browser();
        break;
    case "edit":
开发者ID:evmuc,项目名称:mydns-ng,代码行数:31,代码来源:admin.php


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