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

PHP mysqli_field_count函数代码示例

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

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



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

示例1: ExportTable

function ExportTable($conn, $title, $filter, $dbtable, $dbjoin = "", $joinfield = "")
{
    $query = "SELECT * FROM {$dbtable}";
    if ($dbjoin) {
        $query .= " INNER JOIN {$dbjoin} ON {$dbtable}.{$joinfield}={$dbjoin}.{$joinfield}";
    }
    if ($filter) {
        $query .= " WHERE {$filter}";
    }
    $result = mysqli_query($conn, $query);
    $nrcampos = mysqli_field_count($conn);
    echo "<h2>{$title}</h2>";
    echo "{$dbtable}";
    if ($dbjoin) {
        echo "| <a href=\"dbshow.php?dbtable={$dbjoin}\" target=\"_blank\">{$dbjoin}</a>";
    }
    echo "| " . mysqli_num_rows($result) . " row(s)";
    echo "<p><table cellspacing=\"0\" cellpadding=\"5\" border=\"1\">";
    echo "<tr>";
    for ($i = 0; $i < $nrcampos; $i++) {
        $finfo = mysqli_fetch_field_direct($result, $i);
        echo "<td>" . $finfo->name . "</td>";
    }
    echo "</tr>";
    while ($row = mysqli_fetch_array($result)) {
        echo "<tr>";
        for ($i = 0; $i < $nrcampos; $i++) {
            echo "<td>" . $row[$i] . "</td>";
        }
        echo "</tr>";
    }
    echo "</table></p><br>&nbsp;";
}
开发者ID:jmendonca73,项目名称:caramba,代码行数:33,代码来源:dbshow+-+Copy.php


示例2: fnGetEventData

function fnGetEventData($intThresholdEventID, $intColIndex)
{
    #$intSensorID = fnGet
    #if (!Is_Null($intSensorID)) {
    #$fnGEDSQL = "SELECT * FROM `tblthresholdevents` WHERE ((intThresholdEventID=" . $intThresholdEventID . ") AND booInProcess=1) OR ((intThresholdEventID=" . $intThresholdEventID . ") AND booIsNew=1)";
    $fnGEDSQL = "SELECT * FROM `tblthresholdevents` WHERE ((intThresholdEventID=" . $intThresholdEventID . "))";
    # AND booInProcess=1) OR ((intSensorID=" . $intSensorID . ") AND booIsNew=1)";
    echo "<br>!?!?!? fnGEDSQL: " . $fnGEDSQL;
    $linkged = mysqli_connect('localhost', 'root', '', 'climatecontroldata');
    $EventData = mysqli_query($linkged, $fnGEDSQL);
    #$rsEventData = mysqli_fetch_assoc($EventData);
    $intResCount = @mysqli_num_rows($EventData);
    $intCols = mysqli_field_count($linkged);
    if ($intColIndex <= $intCols) {
        # echo "<br>Total Cols: " . $intCols , "<br>Total Results: " . $intResCount;
        # $rsfnGEDarr = mysqli_fetch_array($EventData);
        # $GEDretVal = $rsfnGEDarr[1][1];
        $rsfnGED = mysqli_fetch_array($EventData, MYSQL_ASSOC);
        #printf("%s (%s)\n", $rsfnGED[0],$rsfnGED[4]);
        #$row = mysqli_fetch_row($EventData);
        $keys = @array_keys($rsfnGED);
        $GEDretVal = $rsfnGED[$keys[$intColIndex]];
    } else {
        echo "Requested ColumnID does not exist";
        die;
    }
    mysqli_close($linkged);
    return $GEDretVal;
}
开发者ID:bh420,项目名称:growroomautomation,代码行数:29,代码来源:base.php


示例3: dump_properties

function dump_properties($mysqli)
{
    printf("\nClass variables:\n");
    $variables = array_keys(get_class_vars(get_class($mysqli)));
    sort($variables);
    foreach ($variables as $k => $var) {
        printf("%s = '%s'\n", $var, var_export(@$mysqli->{$var}, true));
    }
    printf("\nObject variables:\n");
    $variables = array_keys(get_object_vars($mysqli));
    foreach ($variables as $k => $var) {
        printf("%s = '%s'\n", $var, var_export(@$mysqli->{$var}, true));
    }
    printf("\nMagic, magic properties:\n");
    assert(@mysqli_affected_rows($mysqli) === @$mysqli->affected_rows);
    printf("mysqli->affected_rows = '%s'/%s ('%s'/%s)\n", @$mysqli->affected_rows, gettype(@$mysqli->affected_rows), @mysqli_affected_rows($mysqli), gettype(@mysqli_affected_rows($mysqli)));
    assert(@mysqli_get_client_info() === @$mysqli->client_info);
    printf("mysqli->client_info = '%s'/%s ('%s'/%s)\n", @$mysqli->client_info, gettype(@$mysqli->client_info), @mysqli_get_client_info(), gettype(@mysqli_get_client_info()));
    assert(@mysqli_get_client_version() === @$mysqli->client_version);
    printf("mysqli->client_version =  '%s'/%s ('%s'/%s)\n", @$mysqli->client_version, gettype(@$mysqli->client_version), @mysqli_get_client_version(), gettype(@mysqli_get_client_version()));
    assert(@mysqli_errno($mysqli) === @$mysqli->errno);
    printf("mysqli->errno = '%s'/%s ('%s'/%s)\n", @$mysqli->errno, gettype(@$mysqli->errno), @mysqli_errno($mysqli), gettype(@mysqli_errno($mysqli)));
    assert(@mysqli_error($mysqli) === @$mysqli->error);
    printf("mysqli->error = '%s'/%s ('%s'/%s)\n", @$mysqli->error, gettype(@$mysqli->error), @mysqli_error($mysqli), gettype(@mysqli_error($mysqli)));
    assert(@mysqli_field_count($mysqli) === @$mysqli->field_count);
    printf("mysqli->field_count = '%s'/%s ('%s'/%s)\n", @$mysqli->field_count, gettype(@$mysqli->field_count), @mysqli_field_count($mysqli), gettype(@mysqli_field_count($mysqli)));
    assert(@mysqli_insert_id($mysqli) === @$mysqli->insert_id);
    printf("mysqli->insert_id = '%s'/%s ('%s'/%s)\n", @$mysqli->insert_id, gettype(@$mysqli->insert_id), @mysqli_insert_id($mysqli), gettype(@mysqli_insert_id($mysqli)));
    assert(@mysqli_sqlstate($mysqli) === @$mysqli->sqlstate);
    printf("mysqli->sqlstate = '%s'/%s ('%s'/%s)\n", @$mysqli->sqlstate, gettype(@$mysqli->sqlstate), @mysqli_sqlstate($mysqli), gettype(@mysqli_sqlstate($mysqli)));
    assert(@mysqli_get_host_info($mysqli) === @$mysqli->host_info);
    printf("mysqli->host_info = '%s'/%s ('%s'/%s)\n", @$mysqli->host_info, gettype(@$mysqli->host_info), @mysqli_get_host_info($mysqli), gettype(@mysqli_get_host_info($mysqli)));
    /* note that the data types are different */
    assert(@mysqli_info($mysqli) == @$mysqli->info);
    printf("mysqli->info = '%s'/%s ('%s'/%s)\n", @$mysqli->info, gettype(@$mysqli->info), @mysqli_info($mysqli), gettype(@mysqli_info($mysqli)));
    assert(@mysqli_thread_id($mysqli) > @$mysqli->thread_id);
    assert(gettype(@$mysqli->thread_id) == gettype(@mysqli_thread_id($mysqli)));
    printf("mysqli->thread_id = '%s'/%s ('%s'/%s)\n", @$mysqli->thread_id, gettype(@$mysqli->thread_id), @mysqli_thread_id($mysqli), gettype(@mysqli_thread_id($mysqli)));
    assert(@mysqli_get_proto_info($mysqli) === @$mysqli->protocol_version);
    printf("mysqli->protocol_version = '%s'/%s ('%s'/%s)\n", @$mysqli->protocol_version, gettype(@$mysqli->protocol_version), @mysqli_get_proto_info($mysqli), gettype(@mysqli_get_proto_info($mysqli)));
    assert(@mysqli_get_server_info($mysqli) === @$mysqli->server_info);
    printf("mysqli->server_info = '%s'/%s ('%s'/%s)\n", @$mysqli->server_info, gettype(@$mysqli->server_info), @mysqli_get_server_info($mysqli), gettype(@mysqli_get_server_info($mysqli)));
    assert(@mysqli_get_server_version($mysqli) === @$mysqli->server_version);
    printf("mysqli->server_version = '%s'/%s ('%s'/%s)\n", @$mysqli->server_version, gettype(@$mysqli->server_version), @mysqli_get_server_version($mysqli), gettype(@mysqli_get_server_version($mysqli)));
    assert(@mysqli_warning_count($mysqli) === @$mysqli->warning_count);
    printf("mysqli->warning_count = '%s'/%s ('%s'/%s)\n", @$mysqli->warning_count, gettype(@$mysqli->warning_count), @mysqli_warning_count($mysqli), gettype(@mysqli_warning_count($mysqli)));
    printf("\nAccess to undefined properties:\n");
    printf("mysqli->unknown = '%s'\n", @$mysqli->unknown);
    @($mysqli->unknown = 13);
    printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
    $unknown = 'friday';
    @($mysqli->unknown = $unknown);
    printf("setting mysqli->unknown, @mysqli_unknown = '%s'\n", @$mysqli->unknown);
    printf("\nAccess hidden properties for MYSLQI_STATUS_INITIALIZED (TODO documentation):\n");
    assert(@mysqli_connect_error() === @$mysqli->connect_error);
    printf("mysqli->connect_error = '%s'/%s ('%s'/%s)\n", @$mysqli->connect_error, gettype(@$mysqli->connect_error), @mysqli_connect_error(), gettype(@mysqli_connect_error()));
    assert(@mysqli_connect_errno() === @$mysqli->connect_errno);
    printf("mysqli->connect_errno = '%s'/%s ('%s'/%s)\n", @$mysqli->connect_errno, gettype(@$mysqli->connect_errno), @mysqli_connect_errno(), gettype(@mysqli_connect_errno()));
}
开发者ID:alphaxxl,项目名称:hhvm,代码行数:59,代码来源:mysqli_class_mysqli_properties_no_conn.php


示例4: grr_sql_query1

function grr_sql_query1($sql)
{
    $r = mysqli_query($GLOBALS['db_c'], $sql);
    if (!$r) {
        return -1;
    }
    if (mysqli_num_rows($r) != 1 || mysqli_field_count($GLOBALS['db_c']) != 1 || ($result_ = mysqli_result($r, 0, 0)) == "") {
        $result_ = -1;
    }
    mysqli_free_result($r);
    return $result_;
}
开发者ID:Sirlefou1,项目名称:GRR2,代码行数:12,代码来源:mysql.inc.php


示例5: do_download

function do_download()
{
    $backup_name = 'LMT Backup ' . time() . '.sql';
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename="' . $backup_name . '"');
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
    cancel_templateify();
    ob_clean();
    flush();
    echo 'CREATE DATABASE `lmt-bak` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;' . "\n" . 'USE `lmt-bak`;' . "\n\n\n";
    $tables = array();
    $result = DB::queryRaw('SHOW TABLES');
    while ($row = mysqli_fetch_row($result)) {
        $tables[] = $row[0];
    }
    foreach ($tables as $table) {
        $result = DB::queryRaw('SELECT * FROM ' . $table);
        $num_fields = mysqli_field_count($result);
        echo 'DROP TABLE IF EXISTS ' . $table . ';';
        $row2 = mysqli_fetch_row(DB::queryRaw('SHOW CREATE TABLE ' . $table));
        echo "\n\n" . $row2[1] . ";\n\n";
        for ($i = 0; $i < $num_fields; $i++) {
            while ($row = mysqli_fetch_row($result)) {
                echo 'INSERT INTO ' . $table . ' VALUES(';
                for ($j = 0; $j < $num_fields; $j++) {
                    if (!isset($row[$j]) || is_null($row[$j])) {
                        echo 'NULL';
                    } else {
                        $row[$j] = addslashes($row[$j]);
                        $row[$j] = preg_replace("\n", "\\n", $row[$j]);
                        echo '"' . $row[$j] . '"';
                    }
                    if ($j < $num_fields - 1) {
                        echo ',';
                    }
                }
                echo ");\n";
            }
        }
        echo "\n\n\n";
    }
}
开发者ID:lhsmath,项目名称:lhsmath.org,代码行数:45,代码来源:Backup.php


示例6: die

    die("Connection failed: " . $conn->connect_error);
}
//Grab the count of the number of cities PATIENTS
//SELECT city, id FROM femr.patients WHERE city NOT IN (SELECT name FROM mission_cities)
//SELECT city, id FROM femr.patients LIMIT 5
$patientCities = "SELECT city, id FROM femr.patients WHERE city NOT IN(SELECT name FROM mission_cities) LIMIT 5";
$resultQuery = $conn->query($patientCities);
$countQuery = mysqli_field_count($conn);
// while($row = $resultQuery->fetch_array()){
// for($i = 0; $i < $countQuery;$i++)
// echo $row[$i];
// }
//Grabbing the count of the cities DICTIONARY
$cityDictionary = "SELECT name FROM femr.mission_cities";
$resultQuery2 = $conn->query($cityDictionary);
$countQuery2 = mysqli_field_count($conn);
// while($row2 = $resultQuery2->fetch_array()){
// for($j = 0; $j < $countQuery2;$j++)
// echo $row[$j];
// }
?>
  <div class="jumbotron"> <div class='container'>
<center><img align="middle" src="images/femrLogo.png"></img></center>
<center><h1> City Cleanse Results </h1></center>
 <center><div class='row col-md-6 col-md-offset-2 custyle'></center>

 <table class='table table-striped custab table-bordered'>


 <thead>
     <tr>
开发者ID:akrebs1202,项目名称:fEMR-Cleanse-Generator,代码行数:31,代码来源:index.php


示例7: executeSQL

 public function executeSQL($query, &$resultArry, &$rowsAffected, $assoc = TRUE)
 {
     $l_iTries = 3;
     //times
     $l_iPause = 2;
     //seconds
     $l_bConnected = FALSE;
     //bool
     do {
         $link = mysqli_init();
         $rowsAffected = 0;
         if (!$link) {
             throw new DBAdapter2Exception("mysqli_init failed");
         }
         if (!mysqli_options($link, MYSQLI_OPT_CONNECT_TIMEOUT, 5)) {
             throw new DBAdapter2Exception("Setting MYSQLI_OPT_CONNECT_TIMEOUT failed");
         }
         if (!mysqli_real_connect($link, $this->host, $this->username, $this->password, $this->schema)) {
             unset($link);
             sleep($l_iPause);
             $l_iTries = $l_iTries - 1;
         } else {
             $l_bConnected = TRUE;
             $l_iTries = 0;
         }
     } while (!$l_bConnected && $l_iTries > 0);
     if (!$l_bConnected) {
         throw new DBAdapter2Exception('Connect Error (' . mysqli_connect_errno() . ') ' . mysqli_connect_error());
     }
     if (!mysqli_set_charset($link, $this->charset)) {
         throw new DBAdapter2Exception('Error loading character set ' . $this->charset . ' - ' . mysqli_error($link));
     }
     //do queries
     if (mysqli_real_query($link, $query)) {
         //should be e proper select
         if (mysqli_field_count($link)) {
             //buffered
             $result = mysqli_store_result($link);
             if ($result) {
                 $resultArry = array();
                 $rowsAffected = mysqli_num_rows($result);
                 if ($assoc) {
                     while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
                         $resultArry[] = $row;
                     }
                 } else {
                     while ($row = mysqli_fetch_array($result, MYSQLI_NUM)) {
                         $resultArry[] = $row;
                     }
                 }
                 mysqli_free_result($result);
                 unset($result);
             }
         }
     } else {
         throw new DBAdapter2Exception('Error in query: ' . mysqli_error($link));
     }
     mysqli_close($link);
 }
开发者ID:sergrin,项目名称:crawlers-il,代码行数:59,代码来源:DBAdapter2.class.php


示例8: backup_tables_mysqli

 function backup_tables_mysqli($host, $user, $pass, $name, $tables = '*')
 {
     $link = mysqli_connect($host, $user, $pass, $name);
     /* Obtebemos las tablas */
     if ($tables == '*') {
         $tables = array();
         $result = mysqli_query($link, 'SHOW TABLES');
         while ($row = mysqli_fetch_row($result)) {
             $tables[] = $row[0];
         }
     } else {
         $tables = is_array($tables) ? $tables : explode(',', $tables);
     }
     /* generamos el contenido */
     foreach ($tables as $table) {
         $result = mysqli_query($link, 'SELECT * FROM ' . $table);
         $num_fields = mysqli_field_count($link);
         $return .= 'DROP TABLE ' . $table . ';';
         $row2 = mysqli_fetch_row(mysqli_query($link, 'SHOW CREATE TABLE ' . $table));
         $return .= "\n\n" . $row2[1] . ";\n\n";
         for ($i = 0; $i < $num_fields; $i++) {
             while ($row = mysqli_fetch_row($result)) {
                 $return .= 'INSERT INTO ' . $table . ' VALUES(';
                 for ($j = 0; $j < $num_fields; $j++) {
                     $row[$j] = addslashes($row[$j]);
                     $row[$j] = ereg_replace("\n", "\\n", $row[$j]);
                     if (isset($row[$j])) {
                         $return .= '"' . $row[$j] . '"';
                     } else {
                         $return .= '""';
                     }
                     if ($j < $num_fields - 1) {
                         $return .= ',';
                     }
                 }
                 $return .= ");\n";
             }
         }
         $return .= "\n\n\n";
     }
     /* Guardamos el archivo */
     $handle = fopen('db-backup-' . time() . '-' . md5(implode(',', $tables)) . '.sql', 'w+');
     if (fwrite($handle, $return)) {
         fclose($handle);
         echo "<script>alert('Archivo creado, descargalo desde la pagina principal')</script>";
     } else {
         echo "<script>alert('No se pudo descargar')</script>";
     }
 }
开发者ID:hackingcl,项目名称:backdoor-web,代码行数:49,代码来源:unkndown.php


示例9: sql_num_fields

 function sql_num_fields($type, $result, $con)
 {
     if ($type === 'mysql') {
         if (function_exists('mysqli_field_count')) {
             return mysqli_field_count($con);
         } elseif (function_exists('mysql_num_fields')) {
             return mysql_num_fields($result);
         }
     } elseif ($type === 'mssql') {
         if (function_exists('mssql_num_fields')) {
             return mssql_num_fields($result);
         } elseif (function_exists('sqlsrv_num_fields')) {
             return sqlsrv_num_fields($result);
         }
     } elseif ($type === 'pgsql') {
         return pg_num_fields($result);
     } elseif ($type === 'oracle') {
         return oci_num_fields($result);
     } elseif ($type === 'sqlite3') {
         return $result->numColumns();
     } elseif ($type === 'sqlite') {
         return sqlite_num_fields($result);
     } elseif ($type === 'odbc') {
         return odbc_num_fields($result);
     } elseif ($type === 'pdo') {
         return $result->columnCount();
     }
 }
开发者ID:famous0123,项目名称:L4bsForShell,代码行数:28,代码来源:CCCP-Shell.php


示例10: mysqli_real_escape_string

}
if ($_POST['ward'] != '0') {
    $ward_sqlsafe = " AND Participants.Ward = '" . mysqli_real_escape_string($cnnSWOP, $_POST['ward']) . "' ";
} else {
    $ward_sqlsafe = "";
}
$search_pool_sqlsafe = "SELECT * FROM Participants " . $status_sqlsafe . $join_inst_sqlsafe . $benchmarks_sqlsafe . $date_join_sqlsafe . $organizer_join_sqlsafe . $member_type_join_sqlsafe . "LEFT JOIN Participants_Properties ON Participants.Participant_ID=Participants_Properties.Participant_ID\r\n            WHERE Participants.Participant_ID IS NOT NULL " . $institution_sqlsafe . $type_sqlsafe . $step_sqlsafe . $step_done_sqlsafe . $start_sqlsafe . $end_sqlsafe . $lag_sqlsafe . $organizer_sqlsafe . $first_name_sqlsafe . $last_name_sqlsafe . $email_sqlsafe . $phone_sqlsafe . $notes_sqlsafe . $date_of_birth_sqlsafe . $gender_sqlsafe . $has_itin_sqlsafe . $ward_sqlsafe . $language_spoken_sqlsafe;
//echo $search_pool . "<p>";
include "../include/dbconnopen.php";
$search_results = mysqli_query($cnnSWOP, $search_pool_sqlsafe);
?>

<table class="all_projects">
    <caption>Choose the columns you would like to view and export for this query:</caption>
    <?php 
$num_columns = mysqli_field_count($cnnSWOP);
//echo $num_columns;
//this is brought over from PAWS.  I'm trying to give Sarah what she wants in terms of checkboxes to determine which search fields will be
//returned.
$table = '';
for ($k = 0; $k < $num_columns; $k++) {
    $get_column_names = mysqli_fetch_field_direct($search_results, $k);
    //skip Name_Middle field
    if ($get_column_names->name == "Name_Middle") {
        continue;
    }
    if ($get_column_names->table != 'progress' && $get_column_names->table != 'laststatus') {
        if ($get_column_names->table != $table) {
            $table = $get_column_names->table;
            ?>
<tr class="note"><th colspan="4"><a href="javascript:;" onclick="
开发者ID:CompanyOnTheWorld,项目名称:lisc-ttm,代码行数:31,代码来源:individual_search.php


示例11: Query

 /**
  * Executes the given SQL query and returns the records
  *
  * @param string $sql The query string should not end with a semicolon
  * @return object PHP 'mysql result' resource object containing the records
  *                on SELECT, SHOW, DESCRIBE or EXPLAIN queries and returns;
  *                TRUE or FALSE for all others i.e. UPDATE, DELETE, DROP
  *                AND FALSE on all errors (setting the local Error message)
  */
 public function Query($sql)
 {
     $this->ResetError();
     $this->last_sql = $sql;
     $this->last_result = @mysqli_query($this->mysql_link, $sql);
     if (!$this->last_result) {
         $this->active_row = -1;
         $this->SetError();
         return false;
     } else {
         if (strpos(strtolower($sql), "insert") === 0) {
             $this->last_insert_id = mysqli_insert_id($this->mysql_link);
             if ($this->last_insert_id === false) {
                 $this->SetError();
                 return false;
             } else {
                 $numrows = 0;
                 $this->active_row = -1;
                 return $this->last_result;
             }
         } else {
             if (strpos(strtolower($sql), "select") === 0) {
                 $numrows = mysqli_field_count($this->mysql_link);
                 if ($numrows > 0) {
                     $this->active_row = 0;
                 } else {
                     $this->active_row = -1;
                 }
                 $this->last_insert_id = 0;
                 return $this->last_result;
             } else {
                 return $this->last_result;
             }
         }
     }
 }
开发者ID:kimai,项目名称:kimai,代码行数:45,代码来源:mysql.class.php


示例12: queryLastId

 /**
  * Executes query and Return new DBStatementI or int if this is INSERT statement
  *
  * @param $query
  * @return DBStatementI|int
  */
 public function queryLastId($query)
 {
     mysqli_select_db($this->_linkIdentifier, $this->_database);
     if (static::$_debug) {
         echo $query . "<br />\n";
     }
     $queryResult = mysqli_real_query($this->_linkIdentifier, $query);
     $mysqli_field_count = mysqli_field_count($this->_linkIdentifier);
     if ($mysqli_field_count) {
         $result = mysqli_store_result($this->_linkIdentifier);
     } else {
         $result = $queryResult;
     }
     if ($result === true && preg_match('/^\\s*"?(INSERT|REPLACE)\\s+/i', $query)) {
         $insertId = (int) $this->insertId();
         return $insertId;
     }
     return new DBStatementI($result);
 }
开发者ID:spineag,项目名称:farm505-back-end,代码行数:25,代码来源:OwnMySQLI.php


示例13: fieldsCount

 /**
  * フィールド数を取得
  *
  * @return int|null
  */
 public function fieldsCount()
 {
     if ($this->mysql_mode == MYSQL_MODE_MYSQL) {
         return mysql_num_fields($this->linkId);
     } else {
         if ($this->mysql_mode == MYSQL_MODE_MYSQLI) {
             return mysqli_field_count($this->linkId);
         }
     }
     return null;
 }
开发者ID:ateliee,项目名称:php_lib,代码行数:16,代码来源:class_mysql.php


示例14: use_or_store_result

 /**
  *  結果データを構築する
  *
  *  結果セットを取得する
  *    - 一括、逐次読み込みを任意に設定する場合は引数で指定する
  *    - デフォルトは一括読み込みとする
  *
  *  @param   boolean  結果セットを一括読み込みする場合TRUE
  *  @retrun  boolean  TRUE:成功時
  */
 protected function use_or_store_result($store_result)
 {
     // 結果データを返さない場合はそのまま終了
     if (mysqli_field_count($this->le_link) < 1) {
         return TRUE;
     }
     // 結果データを取得
     set_error_handler(array($this, 'php_error_handler'));
     $le_result = $store_result ? mysqli_store_result($this->le_link) : mysqli_use_result($this->le_link);
     restore_error_handler();
     if ($le_result === FALSE) {
         return FALSE;
     }
     // フィールド情報を取得する
     foreach (mysqli_fetch_fields($le_result) as $field) {
         $tmp = array(self::FIELD_DEF_IS_POS => count($this->def_fields), self::FIELD_DEF_IS_TYPE => $field->type, self::FIELD_DEF_IS_NAME => $field->name, self::FIELD_DEF_IS_NAME_ORIG => $field->orgname, self::FIELD_DEF_IS_TABLE => $field->table, self::FIELD_DEF_IS_TABLE_ORIG => $field->orgtable);
         // MEMO : 底層レベルのバグでorgnameが取得できない場合がある
         if (strlen($field->orgname) < 1) {
             $this->def_fields[$field->name] = $tmp;
         } else {
             $this->def_fields[$field->orgname] = $tmp;
         }
     }
     $this->le_result = $le_result;
     $this->affected_rows = mysqli_num_rows($le_result);
 }
开发者ID:gree,项目名称:cascade,代码行数:36,代码来源:MySQLi.php


示例15: getLengthFields

 public function getLengthFields($rs)
 {
     return @mysqli_field_count($rs);
 }
开发者ID:atoledov,项目名称:siglab,代码行数:4,代码来源:MySql.php


示例16: FieldsCount

 public function FieldsCount()
 {
     return mysqli_field_count($this->res);
 }
开发者ID:nolka,项目名称:k5,代码行数:4,代码来源:class.Database.php


示例17: mysqli_stmt_init

$stmt = mysqli_stmt_init($link);
/* Depending on your version, the MySQL server migit not support this */
if ($stmt->prepare('EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2') && $stmt->execute()) {
    if (!mysqli_stmt_store_result($stmt)) {
        printf("[008] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
    }
    if (!($res_meta = mysqli_stmt_result_metadata($stmt))) {
        printf("[009] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
    }
    if (($tmp = mysqli_stmt_num_rows($stmt)) !== $num_rows) {
        printf("[010] Expecting int/%d got %s/%s\n", $num_rows, gettype($tmp), $tmp);
    }
    if (($tmp = mysqli_stmt_field_count($stmt)) !== $num_fields) {
        printf("[011] Expecting int/%d got %s/%s\n", $num_fields, gettype($tmp), $tmp);
    }
    if (($tmp = mysqli_field_count($link)) !== $num_fields) {
        printf("[013] Expecting int/%d got %s/%s\n", $num_fields, gettype($tmp), $tmp);
    }
    if (($tmp = $res_meta->field_count) !== $num_fields) {
        printf("[014] Expecting int/%d got %s/%s\n", $num_fields, gettype($tmp), $tmp);
    }
    $fields_res_meta = mysqli_fetch_fields($res_meta);
    if (($tmp = count($fields_res_meta)) !== $num_fields) {
        printf("[015] Expecting int/%d got %s/%s\n", $num_fields, gettype($tmp), $tmp);
    }
    if ($fields_res_meta != $fields) {
        printf("[016] Prepared Statement metadata differs from normal metadata, dumping\n");
        var_dump($fields_res_meta);
        var_dump($fields);
    }
    if (function_exists('mysqli_stmt_get_result') && $stmt->prepare('EXPLAIN SELECT t1.*, t2.* FROM test AS t1, test AS t2') && $stmt->execute()) {
开发者ID:gleamingthecube,项目名称:php,代码行数:31,代码来源:ext_mysqli_tests_mysqli_explain_metadata.php


示例18: GetJSON

 /**
  * Returns the last query as a JSON document
  *
  * @return string JSON containing all records listed
  */
 public function GetJSON()
 {
     if ($this->last_result) {
         if ($this->RowCount() > 0) {
             for ($i = 0, $il = mysqli_field_count($this->mysql_link); $i < $il; $i++) {
                 $field = mysqli_fetch_field_direct($this->last_result, $i);
                 $types[$i] = $field->type;
             }
             $json = '[';
             $this->MoveFirst();
             while ($member = mysqli_fetch_object($this->last_result)) {
                 $json .= json_encode($member) . ",";
             }
             $json .= ']';
             $json = str_replace("},]", "}]", $json);
         } else {
             $json = 'null';
         }
     } else {
         $this->active_row = -1;
         $json = 'null';
     }
     return $json;
 }
开发者ID:cljk,项目名称:kimai,代码行数:29,代码来源:mysql.class.php


示例19: my_mysqli_connect

<?php

require_once "connect.inc";
/*** test mysqli_connect 127.0.0.1 ***/
$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
mysqli_real_query($link, "SHOW VARIABLES");
if (mysqli_field_count($link)) {
    $result = mysqli_store_result($link);
    $num = mysqli_num_fields($result);
    mysqli_free_result($result);
}
var_dump($num);
mysqli_close($link);
print "done!";
开发者ID:badlamer,项目名称:hhvm,代码行数:14,代码来源:039.php


示例20: printf

}
printf("\nClass variables:\n");
$variables = array_keys(get_class_vars(get_class($mysqli_result)));
sort($variables);
foreach ($variables as $k => $var) {
    printf("%s\n", $var);
}
printf("\nObject variables:\n");
$variables = array_keys(get_object_vars($mysqli_result));
foreach ($variables as $k => $var) {
    printf("%s\n", $var);
}
printf("\nMagic, magic properties:\n");
assert(($tmp = mysqli_field_tell($res)) === $mysqli_result->current_field);
printf("mysqli_result->current_field = '%s'/%s ('%s'/%s)\n", $mysqli_result->current_field, gettype($mysqli_result->current_field), $tmp, gettype($tmp));
assert(($tmp = mysqli_field_count($link)) === $mysqli_result->field_count);
printf("mysqli_result->field_count = '%s'/%s ('%s'/%s)\n", $mysqli_result->field_count, gettype($mysqli_result->field_count), $tmp, gettype($tmp));
assert(($tmp = mysqli_fetch_lengths($res)) === $mysqli_result->lengths);
printf("mysqli_result->lengths -> '%s'/%s ('%s'/%s)\n", is_array($mysqli_result->lengths) ? implode(' ', $mysqli_result->lengths) : 'n/a', gettype($mysqli_result->lengths), is_array($tmp) ? implode(' ', $tmp) : 'n/a', gettype($tmp));
assert(($tmp = mysqli_num_rows($res)) === $mysqli_result->num_rows);
printf("mysqli_result->num_rows = '%s'/%s ('%s'/%s)\n", $mysqli_result->num_rows, gettype($mysqli_result->num_rows), $tmp, gettype($tmp));
assert(in_array($mysqli_result->type, array(MYSQLI_STORE_RESULT, MYSQLI_USE_RESULT)));
printf("mysqli_result->type = '%s'/%s\n", MYSQLI_STORE_RESULT == $mysqli_result->type ? 'store' : 'use', gettype($mysqli_result->type));
printf("\nAccess to undefined properties:\n");
printf("mysqli_result->unknown = '%s'\n", @$mysqli_result->unknown);
printf("\nConstructor:\n");
if (!is_object($res = new mysqli_result($link))) {
    printf("[001] Expecting object/mysqli_result got %s/%s\n", gettye($res), $res);
}
if (!mysqli_query($link, "SELECT id FROM test_mysqli_class_mysqli_result_interface_table_1 ORDER BY id")) {
    printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:mysqli_class_mysqli_result_interface.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP mysqli_field_seek函数代码示例发布时间:2022-05-15
下一篇:
PHP mysqli_fetch_row函数代码示例发布时间: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