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


PHP mysqli_stmt::bind_result方法代码示例

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


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

示例1: fetchResource

 /**
  * @param \mysqli_stmt $resource
  * @param string       $column
  *
  * @return mixed[]
  */
 protected function fetchResource($resource, $column)
 {
     $result = [];
     $metadata = $resource->result_metadata();
     $fields = $metadata->fetch_fields();
     if (count($fields) == 0) {
         return [];
     }
     $variables = [];
     $data = [];
     foreach ($fields as $field) {
         $variables[] =& $data[$field->name];
     }
     $resource->bind_result(...$variables);
     while ($resource->fetch()) {
         $clone = [];
         foreach ($data as $key => $value) {
             $clone[$key] = $value;
         }
         $result[] = $clone;
     }
     $resource->free_result();
     $this->fixTypes($result, $fields, $column);
     return $result;
 }
开发者ID:binsoul,项目名称:db-platform-mysql,代码行数:31,代码来源:StatementResult.php

示例2: caricaIndirizzoDaStmt

 /**
  * Carica un indirizzo eseguendo un prepared statement
  * @param mysqli_stmt $stmt
  * @return null
  */
 public function caricaIndirizzoDaStmt(mysqli_stmt $stmt)
 {
     if (!$stmt->execute()) {
         error_log("[caricaIndirizzoDaStmt] impossibile" . " eseguire lo statement");
         return null;
     }
     $row = array();
     $bind = $stmt->bind_result($row['id'], $row['destinatario'], $row['via_num'], $row['citta'], $row['provincia'], $row['cap'], $row['telefono']);
     if (!$bind) {
         error_log("[caricaIndirizzoDaStmt] impossibile" . " effettuare il binding in output");
         return null;
     }
     if (!$stmt->fetch()) {
         return null;
     }
     $stmt->close();
     return self::creaIndirizzoDaArray($row);
 }
开发者ID:Artorias91,项目名称:Progetto-AMM,代码行数:23,代码来源:IndirizzoFactory.php

示例3: array

 /**
  * Carica una lista di articoli eseguendo un prepared statement
  * @param mysqli_stmt $stmt
  * @return null
  */
 public function &caricaArticoliDaStmt(mysqli_stmt $stmt)
 {
     $articoli = array();
     if (!$stmt->execute()) {
         error_log("[caricaArticoliDaStmt] impossibile" . " eseguire lo statement");
         return null;
     }
     $row = array();
     $bind = $stmt->bind_result($row['id'], $row['size'], $row['qty'], $row['prezzo'], $row['pizza_id']);
     if (!$bind) {
         error_log("[caricaArticoliDaStmt] impossibile" . " effettuare il binding in output");
         return null;
     }
     while ($stmt->fetch()) {
         $articoli[] = self::creaArticoloDaArray($row);
     }
     $stmt->close();
     return $articoli;
 }
开发者ID:Artorias91,项目名称:Progetto-AMM,代码行数:24,代码来源:ArticoloFactory.php

示例4: array

 public function &creaAlbumDaStmt(mysqli_stmt $stmt)
 {
     $album = array();
     if (!$stmt->execute()) {
         error_log("[creaAlbumDaStmt] impossibile" . " eseguire lo statement");
         return null;
     }
     $row = array();
     $bind = $stmt->bind_result($row['id'], $row['nome'], $row['autore'], $row['prezzo']);
     if (!$bind) {
         error_log("[creaAlbumDaStmt] impossibile" . " effettuare il binding in output");
         return null;
     }
     while ($stmt->fetch()) {
         $album = self::creaAlbumDaArray($row);
     }
     $stmt->close();
     return $album;
 }
开发者ID:headlessdoll,项目名称:Amm2015,代码行数:19,代码来源:AlbumFactory.php

示例5: caricaStudenteDaStmt

 /**
  * Carica uno studente eseguendo un prepared statement
  * @param mysqli_stmt $stmt
  * @return null
  */
 private function caricaStudenteDaStmt(mysqli_stmt $stmt)
 {
     if (!$stmt->execute()) {
         error_log("[caricaStudenteDaStmt] impossibile" . " eseguire lo statement");
         return null;
     }
     $row = array();
     $bind = $stmt->bind_result($row['studenti_id'], $row['studenti_nome'], $row['studenti_cognome'], $row['studenti_matricola'], $row['studenti_email'], $row['studenti_citta'], $row['studenti_via'], $row['studenti_cap'], $row['studenti_provincia'], $row['studenti_numero_civico'], $row['studenti_username'], $row['studenti_password'], $row['CdL_id'], $row['CdL_nome'], $row['CdL_codice'], $row['dipartimenti_id'], $row['dipartimenti_nome']);
     if (!$bind) {
         error_log("[caricaStudenteDaStmt] impossibile" . " effettuare il binding in output");
         return null;
     }
     if (!$stmt->fetch()) {
         return null;
     }
     $stmt->close();
     return self::creaStudenteDaArray($row);
 }
开发者ID:nadiajolanda,项目名称:esAMM2014,代码行数:23,代码来源:UserFactory.php

示例6: array

 /**
  * Popola una lista di corsi di laurea con una query variabile
  * Attenzione: non popola il collegamento ai Dipartimenti
  * @param mysqli_stmt $stmt
  * @return array|\CorsoDiLaurea
  */
 private function &inizializzaListaCorsi(mysqli_stmt $stmt)
 {
     $corsi = array();
     if (!$stmt->execute()) {
         error_log("[inizializzaListaCorsi] impossibile" . " eseguire lo statement");
         return $corsi;
     }
     $id = 0;
     $nome = "";
     $codice = "";
     if (!$stmt->bind_result($id, $codice, $nome)) {
         error_log("[inizializzaListaCorsi] impossibile" . " effettuare il binding in output");
         return array();
     }
     while ($stmt->fetch()) {
         $corso = new CorsoDiLaurea();
         $corso->setCodice($codice);
         $corso->setNome($nome);
         $corso->setId($id);
         $corsi[] = $corso;
     }
     return $corsi;
 }
开发者ID:nadiajolanda,项目名称:esAMM2014,代码行数:29,代码来源:CorsoDiLaureaFactory.php

示例7: array

 public function &caricaPODaStmt(mysqli_stmt $stmt)
 {
     $po = array();
     if (!$stmt->execute()) {
         error_log("[caricaPODaStmt] impossibile" . " eseguire lo statement");
         return null;
     }
     $row = array();
     $bind = $stmt->bind_result($row['albumId'], $row['ordineId'], $row['id'], $row['quantita']);
     if (!$bind) {
         error_log("[caricaPODaStmt] impossibile" . " effettuare il binding in output");
         return null;
     }
     while ($stmt->fetch()) {
         $po[] = self::creaPODaArray($row);
     }
     $stmt->close();
     return $po;
 }
开发者ID:headlessdoll,项目名称:Amm2015,代码行数:19,代码来源:Album_ordineFactory.php

示例8: checkBindResult

/**
 * Prepare a statement, but in a way that checks the result, and errors out when it fails.
 * @param mysqli $db
 * @param mysqli_stmt $stmt
 * @param mixed $var1
 * @param mixed $var2
 * @param mixed $var3
 * @param mixed $var4
 */
function checkBindResult($db, $stmt, &$var1, &$var2 = NULL, &$var3 = NULL, &$var4 = NULL)
{
    $num = func_num_args();
    if ($num == 3) {
        $result = $stmt->bind_result($var1);
    } else {
        if ($num == 4) {
            $result = $stmt->bind_result($var1, $var2);
        } else {
            if ($num == 5) {
                $result = $stmt->bind_result($var1, $var2, $var3);
            } else {
                if ($num == 6) {
                    $result = $stmt->bind_result($var1, $var2, $var3, $var4);
                }
            }
        }
    }
    if ($result === FALSE) {
        stmtError($db, $stmt);
    }
}
开发者ID:pdvrieze,项目名称:ProcessManager,代码行数:31,代码来源:common.php

示例9:

<?php

require_once "connect.inc";
$mysql = new my_mysqli($host, $user, $passwd, $db, $port, $socket);
$stmt = new mysqli_stmt($mysql, "SELECT 'foo' FROM DUAL");
$stmt->execute();
$stmt->bind_result($foo);
$stmt->fetch();
$stmt->close();
$mysql->close();
var_dump($foo);
开发者ID:zaky-92,项目名称:php-1,代码行数:11,代码来源:ext_mysqli_tests_063.php

示例10: array

        if (mysqli_stmt_num_rows($stmtUser) == 1) {
            mysqli_stmt_fetch($stmtUser);
            $author['first_name'] = $fisrt_name;
            $author['last_name'] = $last_name;
        }
    }
}
// preapre adventure data
$adventure = array();
$total_progress = 0;
// adventure
$stmtAdventure = new mysqli_stmt($mysqli, "SELECT a.id, a.name, a.description, rate.total_rate, p.id, p.file_ext\nFROM adventures a, photos p, users u, (\n\tSELECT a.id, (IFNULL(v.rate,0)+a.admin_vote) as total_rate\n\tFROM adventures a\n\tLEFT JOIN (\n\t\tSELECT id, COUNT(*) as rate, v.date\n\t\tFROM adventures a, votes v\n\t\tWHERE a.id = v.adv_id\n\t\tGROUP BY id\n\t) v\n\tON a.id = v.id\n) rate\nWHERE a.user_id = u.id\nAND u.id = ?\nAND a.id = rate.id\nAND (p.adv_id = a.id\nAND p.is_cover = 1)\nORDER BY rate.total_rate");
if ($stmtAdventure) {
    $stmtAdventure->bind_param("i", $author['id']);
    if ($stmtAdventure->execute()) {
        $stmtAdventure->bind_result($ad_id, $name, $ad_description, $rate, $photoid, $photoext);
        while ($stmtAdventure->fetch()) {
            $adventure[] = array('id' => $ad_id, 'description' => $ad_description, 'name' => $name, 'pid' => $photoid, 'rate' => $rate, 'pext' => $photoext);
        }
    }
}
//$ad_total = $total_progress;
foreach ($adventure as $stone) {
    ?>

    <div id="top1" class="container">
        <div class="row">
            <div class="col-md-3">
                <img
                    src="./img/contents/<?php 
    echo $stone['pid'] . "." . $stone['pext'];
开发者ID:spiotr12,项目名称:WonderBlog,代码行数:31,代码来源:author.php

示例11: array

                }
            }
        }
    }
}
?>

    <?php 
$commentArray[] = array();
$sql = "SELECT * FROM comments WHERE adv_id = {$adv_id}";
$res = $mysqli->query($sql) or trigger_error($mysqli->error . "[{$sql}]");
while ($row = $res->fetch_assoc()) {
    $stmt3 = new mysqli_stmt($mysqli, "SELECT first_name, last_name FROM users WHERE id = ?");
    $stmt3->bind_param("i", $row['user_id']);
    $stmt3->execute();
    $stmt3->bind_result($commentFirstName, $commentLastName);
    $stmt3->store_result();
    if ($stmt3->num_rows() == 1) {
        while ($stmt3->fetch()) {
            ?>


                <div class="row">
                    <div
                        class="col-md-6 col-md-offset-1 comments-section">


                        <section>
                            <div class="">
                                <label
                                    class=""><?php 
开发者ID:spiotr12,项目名称:WonderBlog,代码行数:31,代码来源:adventure.php

示例12: array

 private function &caricaAppelliDaStmt(mysqli_stmt $stmt)
 {
     $appelli = array();
     if (!$stmt->execute()) {
         error_log("[caricaInsegnamentoDaStmt] impossibile" . " eseguire lo statement");
         return null;
     }
     $row = array();
     $bind = $stmt->bind_result($row['appello_id'], $row['appello_data'], $row['appello_capienza'], $row['insegnamenti_id'], $row['insegnamenti_titolo'], $row['insegnamenti_cfu'], $row['insegnamenti_codice'], $row['docenti_id'], $row['docenti_nome'], $row['docenti_cognome'], $row['docenti_email'], $row['docenti_citta'], $row['docenti_cap'], $row['docenti_via'], $row['docenti_provincia'], $row['docenti_numero_civico'], $row['docenti_ricevimento'], $row['docenti_username'], $row['docenti_password'], $row['dipartimenti_id'], $row['dipartimenti_nome'], $row['CdL_id'], $row['CdL_nome'], $row['CdL_codice']);
     if (!$bind) {
         error_log("[caricaInsegnamentoDaStmt] impossibile" . " effettuare il binding in output");
         return null;
     }
     while ($stmt->fetch()) {
         $appelli[] = self::creaDaArray($row);
     }
     $stmt->close();
     return $appelli;
 }
开发者ID:nadiajolanda,项目名称:esAMM2014,代码行数:19,代码来源:AppelloFactory.php

示例13: caricaOrdiniDaStmt

 /**
  * Carica una lista di ordini eseguendo un prepared statement
  * @param mysqli_stmt $stmt
  * @return null
  */
 public function caricaOrdiniDaStmt(mysqli_stmt $stmt)
 {
     $ordini = array();
     if (!$stmt->execute()) {
         error_log("[caricaOrdiniDaStmt] impossibile" . " eseguire lo statement");
         return null;
     }
     $row = array();
     $bind = $stmt->bind_result($row['id'], $row['data_conclusione'], $row['data_creazione'], $row['subtotale']);
     if (!$bind) {
         error_log("[caricaOrdiniDaStmt] impossibile" . " effettuare il binding in output");
         return null;
     }
     while ($stmt->fetch()) {
         $ordini[] = self::creaOrdineDaArray($row);
     }
     $stmt->close();
     return $ordini;
 }
开发者ID:Artorias91,项目名称:Progetto-AMM,代码行数:24,代码来源:OrdineFactory.php

示例14: caricaPagamentiDaStmt

 /**
  * Carica una lista di pagamenti eseguendo un prepared statement
  * @param mysqli_stmt $stmt
  * @param $flag : 1 -> un metodo | 2 -> piu' di uno
  * @return null
  */
 public function caricaPagamentiDaStmt(mysqli_stmt $stmt, $flag = 1)
 {
     if (!$stmt->execute()) {
         error_log("[caricaPagamentiDaStmt] impossibile" . " eseguire lo statement");
         return null;
     }
     $row = array();
     $bind = $stmt->bind_result($row['id'], $row['saldo'], $row['num_carta'], $row['cod_carta'], $row['scadenza_carta'], $row['titolare_carta'], $row['tipo_carta']);
     if (!$bind) {
         error_log("[caricaPagamentiDaStmt] impossibile" . " effettuare il binding in output");
         return null;
     }
     if ($flag == 1) {
         if (!$stmt->fetch()) {
             return null;
         }
         $stmt->close();
         return self::creaPagamentoDaArray($row);
     } else {
         $pagamenti = array();
         while ($stmt->fetch()) {
             $pagamenti[] = self::creaPagamentoDaArray($row);
         }
         $stmt->close();
         return $pagamenti;
     }
 }
开发者ID:Artorias91,项目名称:Progetto-AMM,代码行数:33,代码来源:PagamentoFactory.php

示例15: AND

                    break;
                case "author":
                    $query = "SELECT A.id, A.name FROM adventures A, users U WHERE A.user_id = U.id AND (CONCAT(first_name, ' ', last_name) LIKE ?)";
                    $bindType = 's';
                    $search = "%" . $search . "%";
                    break;
                case "votes":
                    $query = "SELECT a.id, a.name\n                                          FROM adventures a\n                                          LEFT JOIN (\n                                              SELECT id, COUNT(*) as rate, v.date\n                                              FROM adventures a, votes v\n                                              WHERE a.id = v.adv_id GROUP BY id\n                                          ) v\n                                          ON a.id = v.id\n                                          WHERE (IFNULL(v.rate,0)+a.admin_vote) >= ?";
                    $bindType = 'i';
                    $search = (int) $search;
                    break;
            }
            $stmt = new mysqli_stmt($mysqli, $query);
            if ($stmt->bind_param($bindType, $search)) {
                $stmt->execute();
                $stmt->bind_result($id, $name);
                while ($stmt->fetch()) {
                    $search_results["data"][] = array("id" => $id, "name" => $name);
                }
            }
        }
    }
}
// PRINT SEARCH RESULTS
echo "<ul class='list-group'>";
foreach ($search_results["data"] as $key => $val) {
    ?>
                    <li>
                        <a href="./<?php 
    echo $search_type . ".php?id=" . $val['id'];
    ?>
开发者ID:spiotr12,项目名称:WonderBlog,代码行数:31,代码来源:search.php


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