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


PHP mysqli_errno函数代码示例

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


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

示例1: execute

 public function execute()
 {
     $collect = array();
     $link_count = count($this->links);
     $processed = 0;
     do {
         $links = $errors = $reject = array();
         foreach ($this->links as $link) {
             $links[] = $errors[] = $reject[] = $link;
         }
         if (!mysqli_poll($links, $errors, $reject, 0, 1000)) {
             continue;
         }
         for ($i = 0; $i < $link_count; $i++) {
             $link = $this->links[$i];
             if (mysqli_errno($link)) {
                 throw new \RuntimeException(mysqli_error($link), mysqli_errno($link));
             }
             if ($result = $link->reap_async_query()) {
                 if (is_object($result)) {
                     $temp = array();
                     while (($row = $result->fetch_assoc()) && ($temp[] = $row)) {
                     }
                     $collect[$i] = $temp;
                     mysqli_free_result($result);
                 } else {
                     $collect[$i] = $result;
                 }
             }
             $processed++;
         }
     } while ($processed < $link_count);
     return $collect;
 }
开发者ID:xxoxx,项目名称:async-mysql-php,代码行数:34,代码来源:Async.php

示例2: getJarigenVanDeMaand

 public function getJarigenVanDeMaand()
 {
     // Query voor het verkrijgen van de jarigen van deze maand
     $sSelectiequery = "SELECT voornaam, tussenvoegsel, achternaam, DAY(geboorte_datum) AS dag ";
     $sSelectiequery .= "FROM `ledenlijst` ";
     $sSelectiequery .= "WHERE MONTH(geboorte_datum)= MONTH(CURRENT_TIMESTAMP) ";
     $sSelectiequery .= "ORDER BY DAY(geboorte_datum)";
     // Databaseverbinding met MySQL openen
     $rDatabaseverbinding = mysqli_connect(MYSQL_SERVER, MYSQL_GEBRUIKERSNAAM, MYSQL_WACHTWOORD) or die(mysqli_errno());
     // Verbinding controleren
     if (mysqli_connect_errno()) {
         echo "Fout bij het maken van een verbinding met MySQL: " . mysqli_connect_error();
     }
     // De database van BC Rianto selecteren
     mysqli_select_db($rDatabaseverbinding, MYSQL_DATABASENAAM) or die(sprintf('Hieronder de foutmelding\\n', mysqli_connect_errno(), mysqli_connect_error()));
     // Gegevens van jarigen uit de database halen
     $rRecordset = mysqli_query($rDatabaseverbinding, $sSelectiequery) or die(mysqli_error($rDatabaseverbinding));
     $n = 0;
     $aJarigen = '';
     // Stap 5. Resultaten verwerken als een associatieve array
     while ($aRecord = mysqli_fetch_array($rRecordset, MYSQL_ASSOC)) {
         // Aanmaken nieuwe jarige
         $aJarigen[$n] = array('dag' => $aRecord['dag'], 'naam' => $aRecord['voornaam'] . ' ' . $aRecord['tussenvoegsel'] . ' ' . $aRecord['achternaam']);
         $n++;
     }
     // Resultaat in MySQL vrijgeven
     mysqli_free_result($rRecordset);
     // Databaseverbinding met MySQL sluiten
     mysqli_close($rDatabaseverbinding);
     // Eventueel nog systeembronnen (resources) opruimen
     unset($rRecordset);
     unset($rDatabaseverbinding);
     return $aJarigen;
 }
开发者ID:Pieem105,项目名称:BC-Rianto-mvc,代码行数:34,代码来源:BCRiantoInfoObject.class.php

示例3: insertarMiPrograma

function insertarMiPrograma()
{
    $id_prog = $POST['id_prog'];
    $fecha = $POST['fecha'];
    $evento = $POST['evento'];
    $descripcion = $POST['descripcion'];
    $lugar = $POST['lugar'];
    $horaInicio = $POST['horaInicio'];
    $horaFin = $POST['horaFin'];
    $categoria = $POST['categoria'];
    $usuario_id = $POST['usuario_id'];
    $mysql = new conexion();
    $mysqli = $mysql->conctar();
    echo "{$id_prog} de porgrama";
    echo "{$fecha} de programa";
    echo "{$evento} de programa";
    echo "{$descripcion} de programa";
    echo "{$lugar} de programa";
    echo "{$horaInicio} de programa";
    echo "{$horaFin} de programa";
    echo "{$categoria} de programa";
    echo "{$usuario_id} de usuario";
    $query = "INSERT INTO programa (id_prog, fecha, evento, descripcion, lugar, horaInicio, horaFin, categoria, usuario_id) VALUES ({$id_prog}, '{$fecha}', '{$evento}', '{$descripcion}', '{$lugar}', '{$horaInicio}', '{$horaFin}' '{$categoria}', '{$usuario_id}');";
    mysqli_query($mysqli, $query) or die(mysqli_errno($mysqli));
    mysqli_close($mysqli);
}
开发者ID:juaguzman,项目名称:FestumPhp,代码行数:26,代码来源:insertMiProg.php

示例4: check_db

function check_db($dbhost, $dbuser, $dbpw, $dbname, $tablepre)
{
    if (!function_exists('mysql_connect') && !function_exists('mysqli_connect')) {
        show_msg('undefine_func', 'mysql_connect', 0);
    }
    $mysqlmode = function_exists('mysql_connect') ? 'mysql' : 'mysqli';
    $link = $mysqlmode == 'mysql' ? @mysql_connect($dbhost, $dbuser, $dbpw) : new mysqli($dbhost, $dbuser, $dbpw);
    if (!$link) {
        $errno = $mysqlmode == 'mysql' ? mysql_errno() : mysqli_errno();
        $error = $mysqlmode == 'mysql' ? mysql_error() : mysqli_error();
        if ($errno == 1045) {
            show_msg('database_errno_1045', $error, 0);
        } elseif ($errno == 2003) {
            show_msg('database_errno_2003', $error, 0);
        } else {
            show_msg('database_connect_error', $error, 0);
        }
    } else {
        if ($query = $mysqlmode == 'mysql' ? @mysql_query("SHOW TABLES FROM {$dbname}") : $link->query("SHOW TABLES FROM {$dbname}")) {
            if (!$query) {
                return false;
            }
            while ($row = $mysqlmode == 'mysql' ? mysql_fetch_row($query) : $query->fetch_row()) {
                if (preg_match("/^{$tablepre}/", $row[0])) {
                    return false;
                }
            }
        }
    }
    return true;
}
开发者ID:MCHacker,项目名称:discuz-docker,代码行数:31,代码来源:func.inc.php

示例5: poll_async

function poll_async($offset, $link, $links, $errors, $reject, $exp_ready, $use_oo_syntax)
{
    if ($exp_ready !== ($tmp = mysqli_poll($links, $errors, $reject, 0, 1000))) {
        printf("[%03d + 1] There should be %d links ready to read from, %d ready\n", $offset, $exp_ready, $tmp);
    }
    foreach ($links as $mysqli) {
        if ($use_oo_syntax) {
            $res = $mysqli->reap_async_query();
        } else {
            $res = mysqli_reap_async_query($mysqli);
        }
        if (is_object($res)) {
            printf("[%03d + 2] %s\n", $offset, var_export($res->fetch_assoc(), true));
        } else {
            if (mysqli_errno($mysqli) > 0) {
                printf("[%03d + 3] Error indicated through links array: %d/%s", $offset, mysqli_errno($mysqli), mysqli_error($mysqli));
            } else {
                printf("[%03d + 4] Cannot fetch and no error set - non resultset query (no SELECT)!\n", $offset);
            }
        }
    }
    foreach ($errors as $mysqli) {
        printf("[%03d + 5] Error on %d: %d/%s\n", $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
    }
    foreach ($reject as $mysqli) {
        printf("[%03d + 6] Rejecting thread %d: %d/%s\n", $offset, mysqli_thread_id($mysqli), mysqli_errno($mysqli), mysqli_error($mysqli));
    }
}
开发者ID:zaky-92,项目名称:php-1,代码行数:28,代码来源:ext_mysqli_tests_mysqli_reap_async_query.php

示例6: exeSql

 public static function exeSql($dbname, $sql, $taskid = 0)
 {
     global $db;
     $ret = array();
     if ($taskid == 0) {
         $taskid = key(end(self::$dbPool));
     }
     if (!isset(self::$dbPool[$taskid][$dbname]) || empty(self::$dbPool[$taskid][$dbname])) {
         $db1 = mysqli_connect($db[$dbname]['host'], $db[$dbname]['user'], $db[$dbname]['pswd']) or die("连接 '" . $dbname . "'库失败");
         mysqli_query($db1, "SET NAMES 'UTF8'");
         self::$dbPool[$taskid][$dbname] = $db1;
     } else {
         $db1 = self::$dbPool[$taskid][$dbname];
     }
     if (!($query = mysqli_query($db1, $sql))) {
         throw new \Exception("出錯的SQL:" . $sql . "\t" . mysqli_errno($db1) . ": " . mysqli_error($db1));
     }
     if ($query instanceof \mysqli_result) {
         while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
             $ret[] = $row;
         }
         return $ret;
     } else {
         return $query;
     }
 }
开发者ID:dormscript,项目名称:dataTransfer,代码行数:26,代码来源:Db.php

示例7: findRow

function findRow($offset, $link, $id, $label)
{
    $sql = sprintf("SELECT id, label FROM test_mysqli_stmt_bind_param_references_table_1 WHERE id = '%d' AND label = '%s'", $id, $label);
    if (!($res = mysqli_query($link, $sql))) {
        printf("[%03d + 1] %s failed, [%d] %s\n", $offset, $sql, mysqli_errno($link), mysqli_error($link));
        return false;
    }
    if (!($row = mysqli_fetch_assoc($res))) {
        printf("[%03d + 2] fetch for %s failed, [%d] %s\n", $offset, $sql, mysqli_errno($link), mysqli_error($link));
        return false;
    }
    mysqli_free_result($res);
    if ($row['id'] != $id) {
        printf("[%03d + 3] Expecting %s/%s got %s/%s\n", $offset, gettype($id), $id, gettype($row['id']), $row['id']);
        return false;
    }
    if ($row['label'] != $label) {
        printf("[%03d + 4] Expecting %s/%s got %s/%s\n", $offset, gettype($label), $label, gettype($row['label']), $row['label']);
        return false;
    }
    $sql = sprintf("DELETE FROM test_mysqli_stmt_bind_param_references_table_1 WHERE id = '%d' AND label = '%s'", $id, $label);
    if (!mysqli_query($link, $sql)) {
        printf("[%03d + 5] %s failed, [%d] %s\n", $offset, $sql, mysqli_errno($link), mysqli_error($link));
        return false;
    }
    return true;
}
开发者ID:badlamer,项目名称:hhvm,代码行数:27,代码来源:mysqli_stmt_bind_param_references.php

示例8: verification_mdp

function verification_mdp($adrentre)
{
    global $connect;
    $result = mysqli_query($connect, "select mot_de_passe,id_utilisateur,admin from utilisateur where mail='{$adrentre}'") or die("MsQL Erreur : " . mysqli_errno($connect));
    $resultat = mysqli_fetch_assoc($result);
    return $resultat;
}
开发者ID:parrago,项目名称:App_info,代码行数:7,代码来源:model.php

示例9: new_recover_sql_query

function new_recover_sql_query($sql, $error = G5_DISPLAY_SQL_ERROR, $link = null)
{
    global $g5;
    if (!$link) {
        $link = $g5['connect_db'];
    }
    // Blind SQL Injection 취약점 해결
    $sql = trim($sql);
    // union의 사용을 허락하지 않습니다.
    //$sql = preg_replace("#^select.*from.*union.*#i", "select 1", $sql);
    //$sql = preg_replace("#^select.*from.*[\s\(]+union[\s\)]+.*#i ", "select 1", $sql);
    // `information_schema` DB로의 접근을 허락하지 않습니다.
    //$sql = preg_replace("#^select.*from.*where.*`?information_schema`?.*#i", "select 1", $sql);
    if (function_exists('mysqli_query') && G5_MYSQLI_USE) {
        if ($error) {
            $result = @mysqli_query($link, $sql) or die("<p>{$sql}<p>" . mysqli_errno($link) . " : " . mysqli_error($link) . "<p>error file : {$_SERVER['SCRIPT_NAME']}");
        } else {
            $result = @mysqli_query($link, $sql);
        }
    } else {
        if ($error) {
            $result = @mysql_query($sql, $link) or die("<p>{$sql}<p>" . mysql_errno() . " : " . mysql_error() . "<p>error file : {$_SERVER['SCRIPT_NAME']}");
        } else {
            $result = @mysql_query($sql, $link);
        }
    }
    return $result;
}
开发者ID:peb317,项目名称:gbamn,代码行数:28,代码来源:apms.new.recover.php

示例10: __construct

 public function __construct()
 {
     $this->db_conn = mysqli_connect($this->db_host, $this->db_user, $this->db_pass, $this->db_name);
     if (mysqli_errno($this->db_conn)) {
         die("Failed to connect to database: " + mysqli_error($this->db_conn));
     }
 }
开发者ID:AubreyKodar,项目名称:blogbooster,代码行数:7,代码来源:Model.php

示例11: _dbOpen

 private function _dbOpen()
 {
     $this->dbCon = mysqli_connect(dbHost, dbUser, dbPass, dbName);
     if (!$this->dbCon) {
         die("Connection Failed" . mysqli_errno());
     }
 }
开发者ID:wahgithub,项目名称:chits_wah_emr,代码行数:7,代码来源:dbConnect.php

示例12: dbQuery

function dbQuery($query)
{
    $db = mysqli_connect(SERVERNAME, USERNAME, PASSWORD, DATABASE);
    if (mysqli_connect_errno($db)) {
        $_SESSION['feedback'] = ['color' => 'red', 'message' => 'Problem with database connection.'];
        header('Location: ../index.php');
        die;
    }
    $result = mysqli_query($db, $query);
    if (mysqli_errno($db)) {
        $_SESSION['feedback'] = ['color' => 'red', 'message' => 'Problem with query.'];
        header('Location: ../index.php');
        die;
    }
    if (mysqli_num_rows($result) > 0) {
        while ($row = mysqli_fetch_assoc($result)) {
            $data[] = $row;
        }
    }
    mysqli_free_result($result);
    mysqli_close($db);
    if (!empty($data)) {
        return $data;
    } else {
        return NULL;
    }
}
开发者ID:bobbylcraig,项目名称:WilburProject,代码行数:27,代码来源:functions.php

示例13: get_read

function get_read($url = '', $key, $uid = 1)
{
    $wzurl = "http://mp.weixin.qq.com/s?{$url}&key={$key}&ascene=1&uin=Nzc5OTI2MTIx&pass_ticket=kzTtalLseTrEcwKVHswOVecGMByySYu94gRKdAXokFv2jg4UAOt%2FkrZHb0IwUlSB";
    $bsurl = "http://mp.weixin.qq.com/s?{$url}";
    require_once "Snoopy.class.php";
    $snoopy = new Snoopy();
    $snoopy->agent = "Mozilla/5.0 (iPhone; U; CPU iPhone OS 3_0 like Mac OS X; en-us) AppleWebKit/528.18 (KHTML, like Gecko) Version/4.0 Mobile/7A341 Safari/528.16";
    //伪装浏览器
    $snoopy->fetch($wzurl);
    //获取所有内容
    $content = $snoopy->results;
    //显示结果
    preg_match('/<span id="readNum">([^<]*)<\\/span>/si', $content, $read);
    preg_match('/var likeNum = \'([^<]*)\';/si', $content, $suport);
    // $content = htmlspecialchars($content);
    $content = str_replace(array("'", "\""), array("\\'", "\\\""), $content);
    if ($suport[1] == "赞") {
        $suprot = 0;
    }
    $read = (int) $read[1];
    $suport = (int) $suport[1];
    $connect = mysqli_connect("127.0.0.1", "root", "root") or die("链接数据库失败!");
    mysqli_select_db($connect, "wx_read") or die(mysqli_errno($connect));
    mysqli_query($connect, "SET NAMES 'utf8'");
    $sql = mysqli_query($connect, "INSERT INTO `wx_article` (`uid`, `url`, `content`, `reads`, `suports`) VALUES ('{$uid}','{$bsurl}','{$content}','{$read}','{$suport}');");
    echo "INSERT INTO `wx_article` (`uid`, `url`, `content`, `reads`, `suports`) VALUES ('{$uid}','{$bsurl}','{$content}','{$read}','{$suport}');";
}
开发者ID:uuking,项目名称:test,代码行数:27,代码来源:addURL.php

示例14: driver_db_errno

 function driver_db_errno()
 {
     $db_conn = $this->db_link;
     static $skip_error_codes = array(1091, 1176, 1050, 1060);
     $errno = mysqli_errno($db_conn);
     return in_array($errno, $skip_error_codes) ? 0 : $errno;
 }
开发者ID:rocheux0987,项目名称:rocheux,代码行数:7,代码来源:database.core.php

示例15: insertWhatappMedia

 function insertWhatappMedia($table_name, $whatsapp_media_id, $whatsapp_media_date, $whatsapp_media_name, $whatsapp_media_sender)
 {
     $db = $this->dbcon;
     $status = 0;
     $timestamp = $this->util->generateTimestamp($whatsapp_media_date);
     echo $timestamp;
     if ($table_name == "_tblwhatsappimage") {
         $stmt = $db->prepare("INSERT INTO _tblwhatsappimage (image_id, image_timestamp, image_name, image_sender, image_status) VALUES (?, ?, ?, ?, ?)");
     }
     if ($table_name == "_tblwhatsappaudio") {
         $stmt = $db->prepare("INSERT INTO _tblwhatsappaudio (audio_id, audio_timestamp, audio_name, audio_sender, audio_status) VALUES (?, ?, ?, ?, ?)");
         print_r($stmt);
     }
     if ($table_name == "_tblwhatsappvideo") {
         echo "am called";
         $stmt = $db->prepare("INSERT INTO _tblwhatsappvideo (video_id, video_timestamp, video_name, video_sender, video_status) VALUES (?, ?, ?, ?, ?)");
         print_r($stmt);
     }
     $stmt->bind_param("sssss", $whatsapp_media_id, $timestamp, $whatsapp_media_name, $whatsapp_media_sender, $status);
     $stmt->execute();
     if ($stmt->affected_rows > 0) {
         echo "Insert ok";
     } else {
         echo "Error executing::" . mysqli_errno();
     }
 }
开发者ID:hermansantos,项目名称:whatsapi,代码行数:26,代码来源:class.dbhandler.php


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