本文整理汇总了PHP中mysqli_fetch_field_direct函数的典型用法代码示例。如果您正苦于以下问题:PHP mysqli_fetch_field_direct函数的具体用法?PHP mysqli_fetch_field_direct怎么用?PHP mysqli_fetch_field_direct使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了mysqli_fetch_field_direct函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: single_edit
function single_edit($tbl, $col, $id)
{
$result = getSingle($tbl, $col, $id);
$getResult = mysqli_fetch_array($result);
echo "<form action=\"edit.php\" method=\"POST\">";
echo "<input type=\"hidden\" name=\"tbl\" value=\"{$tbl}\">";
echo "<input type=\"hidden\" name=\"col\" value=\"{$col}\">";
echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\">";
for ($i = 0; $i < mysqli_num_fields($result); $i++) {
$dataType = mysqli_fetch_field_direct($result, $i);
//expects two arguments
$fieldName = $dataType->name;
//like an associative array - allows you to dig into the object and look for "name" (seen as the label in the object with the ->)
//$title = explode('_', $fieldName);
$fieldType = $dataType->type;
//returns a number that can be used
if ($fieldName != $col) {
echo "<label>{$fieldName}</label><br>";
if ($fieldType != 252) {
echo "<input type=\"text\" name=\"{$fieldName}\" value=\"{$getResult[$i]}\">";
} else {
echo "<textarea name=\"{$fieldName}\">{$getResult[$i]}</textarea>";
}
}
}
echo "<input type=\"submit\" value=\"Save Content\">";
echo "</form>";
}
示例2: query
/** Custom SQL Query **/
function query($query, $singleResult = 0)
{
//$query = mysqli_real_escape_string($this->_dbHandle,$query);
//var_dump($query);
$this->_result = mysqli_query($this->_dbHandle, $query);
if (preg_match("/select/i", $query)) {
$result = array();
$table = array();
$field = array();
$tempResults = array();
$numOfFields = mysqli_num_fields($this->_result);
for ($i = 0; $i < $numOfFields; ++$i) {
$table_name = mysqli_fetch_field_direct($this->_result, $i);
array_push($table, $table_name->table);
$fld = mysqli_fetch_field_direct($this->_result, $i);
array_push($field, $fld->name);
}
while ($row = mysqli_fetch_row($this->_result)) {
for ($i = 0; $i < $numOfFields; ++$i) {
$table[$i] = trim(ucfirst($table[$i]), "s");
$tempResults[$table[$i]][$field[$i]] = $row[$i];
}
if ($singleResult == 1) {
mysqli_free_result($this->_result);
return $tempResults;
}
array_push($result, $tempResults);
}
mysqli_free_result($this->_result);
return $result;
}
}
示例3: buatKode
function buatKode($tabel, $inisial)
{
//Mencari nama dan panjang kolom pertama (kode)
$hsl1 = querydb("SELECT * FROM {$tabel} LIMIT 1");
$klm1 = mysqli_fetch_field_direct($hsl1, 0);
//$hsl1 = $msysqli->query("SELECT * FROM $tabel LIMIT 1");
//$klm1 = $hsl1->fetch_fields_direct(0);
$klmNama1 = $klm1->name;
$klmLenght1 = $klm1->length;
$hsl22 = querydb("SELECT max(" . $klmNama1 . ") FROM " . $tabel);
//$hsl22 = querydb($qry2);
$row = arraydb($hsl22);
if (empty($row[0])) {
$angka = 0;
} else {
$angka = substr($row[0], strlen($inisial));
//$angka = $row[0];;
}
$angka = $angka + 1;
$angka = strval($angka);
//Membuat angka 0 untuk mengisi digit yang kosong
$tmp = "";
for ($i = 1; $i <= $klmLenght1 - strlen($inisial) - strlen($angka); $i++) {
$tmp = $tmp . "0";
}
return $inisial . $tmp . $angka;
//return $klmLenght1;
}
示例4: mysqli_field_flags
function mysqli_field_flags($result, $field_offset)
{
static $flags;
$flags_num = mysqli_fetch_field_direct($result, $field_offset)->flags;
if (!isset($flags)) {
$flags = array();
$constants = get_defined_constants(true);
foreach ($constants['mysqli'] as $c => $n) {
if (preg_match('/MYSQLI_(.*)_FLAG$/', $c, $m)) {
if (!array_key_exists($n, $flags)) {
$flags[$n] = $m[1];
}
}
}
}
$result = array();
foreach ($flags as $n => $t) {
if ($flags_num & $n) {
$result[] = $t;
}
}
$return = implode(' ', $result);
$return = str_replace('PRI_KEY', 'PRIMARY_KEY', $return);
$return = strtolower($return);
return $return;
}
示例5: 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> ";
}
示例6: check_imptotal
/**
* Check imptotal
*
* @return bool
*/
public function check_imptotal()
{
$sql = 'SELECT `imptotal` FROM `' . $GLOBALS['xoopsDB']->prefix('banner') . '` WHERE `bid` = 1';
if ($result = $GLOBALS['xoopsDB']->queryF($sql)) {
$fieldInfo = mysqli_fetch_field_direct($result, 0);
$length = $fieldInfo->length;
return $length != 8;
}
return null;
}
示例7: dumpMySQL
function dumpMySQL()
{
global $dbc;
$connexion = $dbc;
$entete = "-- ----------------------\n";
$entete .= "-- dump de la base " . $base . " au " . date("d-M-Y") . "\n";
$entete .= "-- ----------------------\n\n\n";
$creations = "";
$insertions = "\n\n";
$listeTables = mysqli_query($connexion, "show tables");
while ($table = mysqli_fetch_array($listeTables)) {
// si l'utilisateur a demande la structure ou la totale
//if ( $table[0] == "cahiertxt" || $table[0] == "onglets" )
if (mb_ereg("^cahiertxt", $table[0]) || mb_ereg("^onglets", $table[0])) {
$creations .= "-- -----------------------------\n";
$creations .= "-- creation de la table " . $table[0] . "\n";
$creations .= "-- -----------------------------\n";
$creations .= "DROP TABLE IF EXISTS `" . $table[0] . "`;\n";
$listeCreationsTables = mysqli_query($connexion, "show create table " . $table[0]);
while ($creationTable = mysqli_fetch_array($listeCreationsTables)) {
$creations .= $creationTable[1] . ";\n\n";
}
//donnees
$donnees = mysqli_query($GLOBALS["___mysqli_ston"], "SELECT * FROM " . $table[0] . " WHERE login='" . $_SESSION['login'] . "'");
$insertions .= "-- -----------------------------\n";
$insertions .= "-- insertions dans la table " . $table[0] . "\n";
$insertions .= "-- -----------------------------\n";
while ($nuplet = mysqli_fetch_array($donnees)) {
$insertions .= "INSERT INTO " . $table[0] . " VALUES(";
for ($i = 0; $i < (($___mysqli_tmp = mysqli_num_fields($donnees)) ? $___mysqli_tmp : false); $i++) {
if ($i != 0) {
$insertions .= ", ";
}
if ((is_object($___mysqli_tmp = mysqli_fetch_field_direct($donnees, 0)) && !is_null($___mysqli_tmp = $___mysqli_tmp->type) ? ($___mysqli_tmp = (string) substr(($___mysqli_tmp == MYSQLI_TYPE_STRING || $___mysqli_tmp == MYSQLI_TYPE_VAR_STRING ? "string " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24)) ? "int " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, defined("MYSQLI_TYPE_NEWDECIMAL") ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)) ? "real " : "") . ($___mysqli_tmp == MYSQLI_TYPE_TIMESTAMP ? "timestamp " : "") . ($___mysqli_tmp == MYSQLI_TYPE_YEAR ? "year " : "") . ($___mysqli_tmp == MYSQLI_TYPE_DATE || $___mysqli_tmp == MYSQLI_TYPE_NEWDATE ? "date " : "") . ($___mysqli_tmp == MYSQLI_TYPE_TIME ? "time " : "") . ($___mysqli_tmp == MYSQLI_TYPE_SET ? "set " : "") . ($___mysqli_tmp == MYSQLI_TYPE_ENUM ? "enum " : "") . ($___mysqli_tmp == MYSQLI_TYPE_GEOMETRY ? "geometry " : "") . ($___mysqli_tmp == MYSQLI_TYPE_DATETIME ? "datetime " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)) ? "blob " : "") . ($___mysqli_tmp == MYSQLI_TYPE_NULL ? "null " : ""), 0, -1)) == "" ? "unknown" : $___mysqli_tmp : false) == "string" || (is_object($___mysqli_tmp = mysqli_fetch_field_direct($donnees, 0)) && !is_null($___mysqli_tmp = $___mysqli_tmp->type) ? ($___mysqli_tmp = (string) substr(($___mysqli_tmp == MYSQLI_TYPE_STRING || $___mysqli_tmp == MYSQLI_TYPE_VAR_STRING ? "string " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24)) ? "int " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, defined("MYSQLI_TYPE_NEWDECIMAL") ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)) ? "real " : "") . ($___mysqli_tmp == MYSQLI_TYPE_TIMESTAMP ? "timestamp " : "") . ($___mysqli_tmp == MYSQLI_TYPE_YEAR ? "year " : "") . ($___mysqli_tmp == MYSQLI_TYPE_DATE || $___mysqli_tmp == MYSQLI_TYPE_NEWDATE ? "date " : "") . ($___mysqli_tmp == MYSQLI_TYPE_TIME ? "time " : "") . ($___mysqli_tmp == MYSQLI_TYPE_SET ? "set " : "") . ($___mysqli_tmp == MYSQLI_TYPE_ENUM ? "enum " : "") . ($___mysqli_tmp == MYSQLI_TYPE_GEOMETRY ? "geometry " : "") . ($___mysqli_tmp == MYSQLI_TYPE_DATETIME ? "datetime " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)) ? "blob " : "") . ($___mysqli_tmp == MYSQLI_TYPE_NULL ? "null " : ""), 0, -1)) == "" ? "unknown" : $___mysqli_tmp : false) == "blob" || (is_object($___mysqli_tmp = mysqli_fetch_field_direct($donnees, 0)) && !is_null($___mysqli_tmp = $___mysqli_tmp->type) ? ($___mysqli_tmp = (string) substr(($___mysqli_tmp == MYSQLI_TYPE_STRING || $___mysqli_tmp == MYSQLI_TYPE_VAR_STRING ? "string " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24)) ? "int " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, defined("MYSQLI_TYPE_NEWDECIMAL") ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)) ? "real " : "") . ($___mysqli_tmp == MYSQLI_TYPE_TIMESTAMP ? "timestamp " : "") . ($___mysqli_tmp == MYSQLI_TYPE_YEAR ? "year " : "") . ($___mysqli_tmp == MYSQLI_TYPE_DATE || $___mysqli_tmp == MYSQLI_TYPE_NEWDATE ? "date " : "") . ($___mysqli_tmp == MYSQLI_TYPE_TIME ? "time " : "") . ($___mysqli_tmp == MYSQLI_TYPE_SET ? "set " : "") . ($___mysqli_tmp == MYSQLI_TYPE_ENUM ? "enum " : "") . ($___mysqli_tmp == MYSQLI_TYPE_GEOMETRY ? "geometry " : "") . ($___mysqli_tmp == MYSQLI_TYPE_DATETIME ? "datetime " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)) ? "blob " : "") . ($___mysqli_tmp == MYSQLI_TYPE_NULL ? "null " : ""), 0, -1)) == "" ? "unknown" : $___mysqli_tmp : false) == "timestamp" || (is_object($___mysqli_tmp = mysqli_fetch_field_direct($donnees, 0)) && !is_null($___mysqli_tmp = $___mysqli_tmp->type) ? ($___mysqli_tmp = (string) substr(($___mysqli_tmp == MYSQLI_TYPE_STRING || $___mysqli_tmp == MYSQLI_TYPE_VAR_STRING ? "string " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24)) ? "int " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, defined("MYSQLI_TYPE_NEWDECIMAL") ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)) ? "real " : "") . ($___mysqli_tmp == MYSQLI_TYPE_TIMESTAMP ? "timestamp " : "") . ($___mysqli_tmp == MYSQLI_TYPE_YEAR ? "year " : "") . ($___mysqli_tmp == MYSQLI_TYPE_DATE || $___mysqli_tmp == MYSQLI_TYPE_NEWDATE ? "date " : "") . ($___mysqli_tmp == MYSQLI_TYPE_TIME ? "time " : "") . ($___mysqli_tmp == MYSQLI_TYPE_SET ? "set " : "") . ($___mysqli_tmp == MYSQLI_TYPE_ENUM ? "enum " : "") . ($___mysqli_tmp == MYSQLI_TYPE_GEOMETRY ? "geometry " : "") . ($___mysqli_tmp == MYSQLI_TYPE_DATETIME ? "datetime " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)) ? "blob " : "") . ($___mysqli_tmp == MYSQLI_TYPE_NULL ? "null " : ""), 0, -1)) == "" ? "unknown" : $___mysqli_tmp : false) == "date") {
$insertions .= "'";
}
$insertions .= addslashes($nuplet[$i]);
if ((is_object($___mysqli_tmp = mysqli_fetch_field_direct($donnees, 0)) && !is_null($___mysqli_tmp = $___mysqli_tmp->type) ? ($___mysqli_tmp = (string) substr(($___mysqli_tmp == MYSQLI_TYPE_STRING || $___mysqli_tmp == MYSQLI_TYPE_VAR_STRING ? "string " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24)) ? "int " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, defined("MYSQLI_TYPE_NEWDECIMAL") ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)) ? "real " : "") . ($___mysqli_tmp == MYSQLI_TYPE_TIMESTAMP ? "timestamp " : "") . ($___mysqli_tmp == MYSQLI_TYPE_YEAR ? "year " : "") . ($___mysqli_tmp == MYSQLI_TYPE_DATE || $___mysqli_tmp == MYSQLI_TYPE_NEWDATE ? "date " : "") . ($___mysqli_tmp == MYSQLI_TYPE_TIME ? "time " : "") . ($___mysqli_tmp == MYSQLI_TYPE_SET ? "set " : "") . ($___mysqli_tmp == MYSQLI_TYPE_ENUM ? "enum " : "") . ($___mysqli_tmp == MYSQLI_TYPE_GEOMETRY ? "geometry " : "") . ($___mysqli_tmp == MYSQLI_TYPE_DATETIME ? "datetime " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)) ? "blob " : "") . ($___mysqli_tmp == MYSQLI_TYPE_NULL ? "null " : ""), 0, -1)) == "" ? "unknown" : $___mysqli_tmp : false) == "string" || (is_object($___mysqli_tmp = mysqli_fetch_field_direct($donnees, 0)) && !is_null($___mysqli_tmp = $___mysqli_tmp->type) ? ($___mysqli_tmp = (string) substr(($___mysqli_tmp == MYSQLI_TYPE_STRING || $___mysqli_tmp == MYSQLI_TYPE_VAR_STRING ? "string " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24)) ? "int " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, defined("MYSQLI_TYPE_NEWDECIMAL") ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)) ? "real " : "") . ($___mysqli_tmp == MYSQLI_TYPE_TIMESTAMP ? "timestamp " : "") . ($___mysqli_tmp == MYSQLI_TYPE_YEAR ? "year " : "") . ($___mysqli_tmp == MYSQLI_TYPE_DATE || $___mysqli_tmp == MYSQLI_TYPE_NEWDATE ? "date " : "") . ($___mysqli_tmp == MYSQLI_TYPE_TIME ? "time " : "") . ($___mysqli_tmp == MYSQLI_TYPE_SET ? "set " : "") . ($___mysqli_tmp == MYSQLI_TYPE_ENUM ? "enum " : "") . ($___mysqli_tmp == MYSQLI_TYPE_GEOMETRY ? "geometry " : "") . ($___mysqli_tmp == MYSQLI_TYPE_DATETIME ? "datetime " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)) ? "blob " : "") . ($___mysqli_tmp == MYSQLI_TYPE_NULL ? "null " : ""), 0, -1)) == "" ? "unknown" : $___mysqli_tmp : false) == "blob" || (is_object($___mysqli_tmp = mysqli_fetch_field_direct($donnees, 0)) && !is_null($___mysqli_tmp = $___mysqli_tmp->type) ? ($___mysqli_tmp = (string) substr(($___mysqli_tmp == MYSQLI_TYPE_STRING || $___mysqli_tmp == MYSQLI_TYPE_VAR_STRING ? "string " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24)) ? "int " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, defined("MYSQLI_TYPE_NEWDECIMAL") ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)) ? "real " : "") . ($___mysqli_tmp == MYSQLI_TYPE_TIMESTAMP ? "timestamp " : "") . ($___mysqli_tmp == MYSQLI_TYPE_YEAR ? "year " : "") . ($___mysqli_tmp == MYSQLI_TYPE_DATE || $___mysqli_tmp == MYSQLI_TYPE_NEWDATE ? "date " : "") . ($___mysqli_tmp == MYSQLI_TYPE_TIME ? "time " : "") . ($___mysqli_tmp == MYSQLI_TYPE_SET ? "set " : "") . ($___mysqli_tmp == MYSQLI_TYPE_ENUM ? "enum " : "") . ($___mysqli_tmp == MYSQLI_TYPE_GEOMETRY ? "geometry " : "") . ($___mysqli_tmp == MYSQLI_TYPE_DATETIME ? "datetime " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)) ? "blob " : "") . ($___mysqli_tmp == MYSQLI_TYPE_NULL ? "null " : ""), 0, -1)) == "" ? "unknown" : $___mysqli_tmp : false) == "timestamp" || (is_object($___mysqli_tmp = mysqli_fetch_field_direct($donnees, 0)) && !is_null($___mysqli_tmp = $___mysqli_tmp->type) ? ($___mysqli_tmp = (string) substr(($___mysqli_tmp == MYSQLI_TYPE_STRING || $___mysqli_tmp == MYSQLI_TYPE_VAR_STRING ? "string " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY, MYSQLI_TYPE_SHORT, MYSQLI_TYPE_LONG, MYSQLI_TYPE_LONGLONG, MYSQLI_TYPE_INT24)) ? "int " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_FLOAT, MYSQLI_TYPE_DOUBLE, MYSQLI_TYPE_DECIMAL, defined("MYSQLI_TYPE_NEWDECIMAL") ? constant("MYSQLI_TYPE_NEWDECIMAL") : -1)) ? "real " : "") . ($___mysqli_tmp == MYSQLI_TYPE_TIMESTAMP ? "timestamp " : "") . ($___mysqli_tmp == MYSQLI_TYPE_YEAR ? "year " : "") . ($___mysqli_tmp == MYSQLI_TYPE_DATE || $___mysqli_tmp == MYSQLI_TYPE_NEWDATE ? "date " : "") . ($___mysqli_tmp == MYSQLI_TYPE_TIME ? "time " : "") . ($___mysqli_tmp == MYSQLI_TYPE_SET ? "set " : "") . ($___mysqli_tmp == MYSQLI_TYPE_ENUM ? "enum " : "") . ($___mysqli_tmp == MYSQLI_TYPE_GEOMETRY ? "geometry " : "") . ($___mysqli_tmp == MYSQLI_TYPE_DATETIME ? "datetime " : "") . (in_array($___mysqli_tmp, array(MYSQLI_TYPE_TINY_BLOB, MYSQLI_TYPE_BLOB, MYSQLI_TYPE_MEDIUM_BLOB, MYSQLI_TYPE_LONG_BLOB)) ? "blob " : "") . ($___mysqli_tmp == MYSQLI_TYPE_NULL ? "null " : ""), 0, -1)) == "" ? "unknown" : $___mysqli_tmp : false) == "date") {
$insertions .= "'";
}
}
$insertions .= ");\n";
}
$insertions .= "\n";
}
}
is_null($___mysqli_res = mysqli_close($connexion)) ? false : $___mysqli_res;
$rep_tmp = "/tmp/" . $_SESSION['login'];
mkdir($rep_tmp);
$fichierDump = fopen($rep_tmp . "/dump.sql", "wb");
fwrite($fichierDump, $entete);
fwrite($fichierDump, $creations);
fwrite($fichierDump, $insertions);
fclose($fichierDump);
}
示例8: mysqli_field_type
function mysqli_field_type($result, $field_offset)
{
static $types;
$type_id = mysqli_fetch_field_direct($result, $field_offset)->type;
if (!isset($types)) {
$types = array();
$constants = get_defined_constants(true);
foreach ($constants['mysqli'] as $c => $n) {
if (preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) {
$types[$n] = $m[1];
}
}
}
return array_key_exists($type_id, $types) ? $types[$type_id] : NULL;
}
示例9: mysql_field_len
case "mysql":
$ret = mysql_field_len($result, $offset);
break;
case "mysqli":
$tmp = mysqli_fetch_field_direct($result, $offset);
$ret = $tmp->length;
break;
}
return $ret;
}
function yog_mysql_field_flags($result, $offset)
{
//Get the flags associated with the specified field in a result
$ret = 0;
switch (DB_EXTENSION) {
case "mysql":
示例10: parse
/**
* Parse resource into array
*
* @param resource $resource
* @return array
*/
public function parse($resource)
{
$result = array();
$fieldcnt = mysqli_num_fields($resource);
$fields_transform = array();
for ($i = 0; $i < $fieldcnt; $i++) {
$finfo = mysqli_fetch_field_direct($resource, $i);
if (isset(self::$mysqli_type[$finfo->type])) {
$fields_transform[$finfo->name] = self::$mysqli_to_php[self::$mysqli_type[$finfo->type]];
}
}
while ($row = mysqli_fetch_assoc($resource)) {
foreach ($fields_transform as $fieldname => $fieldtype) {
settype($row[$fieldname], $fieldtype);
}
$result[] = $row;
}
return $result;
}
示例11: field_name
function field_name($offset, $query_id = 0)
{
global $db_type;
if (!$query_id) {
$query_id = $this->query_result;
}
if ($query_id) {
switch ($db_type) {
case 'mysql':
$result = @mysql_field_name($query_id, $offset);
break;
case 'mysqli':
$finfo = @mysqli_fetch_field_direct($query_id, $offset);
$result = $finfo->name;
}
return $result;
} else {
return false;
}
}
示例12: TableShow
function TableShow($result)
{
echo "<table>";
echo "<tr>";
// print headers
for ($i = 0; $i < mysqli_num_fields($result); $i++) {
$field_info = mysqli_fetch_field_direct($result, $i);
echo "<th>{$field_info->name}</th>";
}
echo "</tr>";
// print data
while ($tableRow = mysqli_fetch_assoc($result)) {
echo "<tr>";
foreach ($tableRow as $key => $value) {
echo "<td>" . $tableRow[$key] . "</td>";
//echo $key;
}
echo "</tr>";
}
echo "</table>";
}
示例13: getResultColumns
/**
* Returns metadata for all columns in a result set.
* @return array
*/
public function getResultColumns()
{
static $types;
if ($types === NULL) {
$consts = get_defined_constants(TRUE);
$types = [];
foreach (isset($consts['mysqli']) ? $consts['mysqli'] : [] as $key => $value) {
if (strncmp($key, 'MYSQLI_TYPE_', 12) === 0) {
$types[$value] = substr($key, 12);
}
}
$types[MYSQLI_TYPE_TINY] = $types[MYSQLI_TYPE_SHORT] = $types[MYSQLI_TYPE_LONG] = 'INT';
}
$count = mysqli_num_fields($this->resultSet);
$columns = [];
for ($i = 0; $i < $count; $i++) {
$row = (array) mysqli_fetch_field_direct($this->resultSet, $i);
$columns[] = ['name' => $row['name'], 'table' => $row['orgtable'], 'fullname' => $row['table'] ? $row['table'] . '.' . $row['name'] : $row['name'], 'nativetype' => isset($types[$row['type']]) ? $types[$row['type']] : $row['type'], 'type' => $row['type'] === MYSQLI_TYPE_TIME ? Dibi\Type::TIME_INTERVAL : NULL, 'vendor' => $row];
}
return $columns;
}
示例14: _getColumnNames
/**
* Retrieve the names of columns returned by the DBMS in a query result.
*
* @return mixed Array variable that holds the names of columns as keys
* or an MDB2 error on failure.
* Some DBMS may not return any columns when the result set
* does not contain any rows.
* @access private
*/
function _getColumnNames()
{
$columns = array();
$numcols = $this->numCols();
if (PEAR::isError($numcols)) {
return $numcols;
}
for ($column = 0; $column < $numcols; $column++) {
$column_info = @mysqli_fetch_field_direct($this->result, $column);
$columns[$column_info->name] = $column;
}
if ($this->db->options['portability'] & MDB2_PORTABILITY_FIX_CASE) {
$columns = array_change_key_case($columns, $this->db->options['field_case']);
}
return $columns;
}
示例15: fieldFlags
/**
* returns concatenated string of human readable field flags
*
* @param mysqli_result $result result set identifier
* @param int $i field
*
* @return string field flags
*/
public function fieldFlags($result, $i)
{
$f = mysqli_fetch_field_direct($result, $i);
$type = $f->type;
$charsetnr = $f->charsetnr;
$f = $f->flags;
$flags = array();
foreach ($GLOBALS['pma_mysqli_flag_names'] as $flag => $name) {
if ($f & $flag) {
$flags[] = $name;
}
}
// See http://dev.mysql.com/doc/refman/6.0/en/c-api-datatypes.html:
// to determine if a string is binary, we should not use MYSQLI_BINARY_FLAG
// but instead the charsetnr member of the MYSQL_FIELD
// structure. Watch out: some types like DATE returns 63 in charsetnr
// so we have to check also the type.
// Unfortunately there is no equivalent in the mysql extension.
if (($type == MYSQLI_TYPE_TINY_BLOB || $type == MYSQLI_TYPE_BLOB || $type == MYSQLI_TYPE_MEDIUM_BLOB || $type == MYSQLI_TYPE_LONG_BLOB || $type == MYSQLI_TYPE_VAR_STRING || $type == MYSQLI_TYPE_STRING) && 63 == $charsetnr) {
$flags[] = 'binary';
}
return implode(' ', $flags);
}