本文整理匯總了PHP中mysqli_free_result函數的典型用法代碼示例。如果您正苦於以下問題:PHP mysqli_free_result函數的具體用法?PHP mysqli_free_result怎麽用?PHP mysqli_free_result使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了mysqli_free_result函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: execute_multi
function execute_multi($link, $arr_sqls, &$error)
{
$sqls = implode(';', $arr_sqls) . ';';
if (mysqli_multi_query($link, $sqls)) {
$data = array();
$i = 0;
//計數
do {
if ($result = mysqli_store_result($link)) {
$data[$i] = mysqli_fetch_all($result);
mysqli_free_result($result);
} else {
$data[$i] = null;
}
$i++;
if (!mysqli_more_results($link)) {
break;
}
} while (mysqli_next_result($link));
if ($i == count($arr_sqls)) {
return $data;
} else {
$error = "sql語句執行失敗:<br /> 數組下標為{$i}的語句:{$arr_sqls[$i]}執行錯誤<br /> 錯誤原因:" . mysqli_error($link);
return false;
}
} else {
$error = '執行失敗!請檢查首條語句是否正確!<br />可能的錯誤原因:' . mysqli_error($link);
return false;
}
}
示例2: processQuery
public function processQuery($sql, $type = NULL)
{
$result = mysqli_query($this->db, $sql);
$this->checkForError();
$data = array();
if ($result instanceof mysqli_result) {
$resultType = MYSQLI_NUM;
if ($type == 'assoc') {
$resultType = MYSQLI_ASSOC;
}
while ($row = mysqli_fetch_array($result, $resultType)) {
if (mysqli_affected_rows($this->db) > 1) {
array_push($data, $row);
} else {
$data = $row;
}
}
mysqli_free_result($result);
} else {
if ($result) {
$data = mysqli_insert_id($this->db);
}
}
return $data;
}
示例3: iimysqli_stmt_get_result
public static function iimysqli_stmt_get_result($stmt)
{
/** EXPLANATION:
* We are creating a fake "result" structure to enable us to have
* source-level equivalent syntax to a query executed via
* mysqli_query().
*
* $stmt = mysqli_prepare($conn, "");
* mysqli_bind_param($stmt, "types", ...);
*
* $param1 = 0;
* $param2 = 'foo';
* $param3 = 'bar';
* mysqli_execute($stmt);
* $result _mysqli_stmt_get_result($stmt);
* [ $arr = _mysqli_result_fetch_array($result);
* || $assoc = _mysqli_result_fetch_assoc($result); ]
* mysqli_stmt_close($stmt);
* mysqli_close($conn);
*
* At the source level, there is no difference between this and mysqlnd.
**/
$metadata = mysqli_stmt_result_metadata($stmt);
$ret = new iimysqli_result();
if (!$ret) {
return NULL;
}
$ret->nCols = mysqli_num_fields($metadata);
$ret->columns = $metadata->fetch_fields();
$ret->stmt = $stmt;
mysqli_free_result($metadata);
return $ret;
}
示例4: 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;
}
示例5: delete
public function delete($id)
{
$id = mysqli_real_escape_string($this->connection, $id);
$query = "DELETE FROM posts WHERE id = '{$id}'";
$result = mysqli_query($this->connection, $query);
mysqli_free_result($result);
}
示例6: editPage
function editPage($id)
{
include_once 'login.php';
include_once 'database_conn.php';
include_once 'showEventFunction.php';
$pageHeader = "Event Edit Page";
$sql = "SELECT * FROM te_events WHERE eventID = {$id}";
$rslt = mysqli_query($conn, $sql) or die(mysqli_error($conn));
// error message return if return empty result
$row = mysqli_fetch_row($rslt);
$venues = getFromDb($conn, "SELECT * FROM te_venue");
$categories = getFromDb($conn, "SELECT * FROM te_category");
$output = "<h1>{$pageHeader}</h1>";
$i = 1;
$output .= "<form id=\"editForm\" action=\"handleEditPage.php\" method=\"post\">";
$output .= "<table border=0 >";
$output .= createRowData("Title", createTextField("title", $row[$i++]));
$output .= createRowData("Description", createTextArea("desc", $row[$i++], 5, 40));
$output .= createRowData("Venue Name", createCombobox("venue", $row[$i++], $venues));
$output .= createRowData("Category", createCombobox("category", $row[$i++], $categories));
$output .= createRowData("Start Time", createDate("startTime", $row[$i++]));
$output .= createRowData("End Time", createDate("endTime", $row[$i++]));
$output .= createRowData("Price", createTextField("price", $row[$i++]));
$output .= "<tr><td><input type=\"submit\" name=\"submit\" value=\"Submit\"></td></tr>";
$output .= "<input type=\"hidden\" name=\"e_id\" value=\"{$id}\">";
$output .= "</table></form>";
mysqli_free_result($rslt);
mysqli_close($conn);
return $output;
}
示例7: free
private function free()
{
if ($this->queryID) {
mysqli_free_result($this->queryID);
$this->queryID = null;
}
}
示例8: getUserData
function getUserData($phoneNumber)
{
$sql = "SELECT * FROM `nicdata` WHERE `phoneNumber`='" . $phoneNumber . "'";
$conn = new mysqli(constant("SERVER_NAME_NIC"), constant("DB_USER_NIC"), constant("DB_PASSWORD_NIC"), constant("DB_NAME_NIC"));
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$result = mysqli_query($conn, $sql);
$json = "";
if (!$result) {
die("Invalid query: " . mysqli_error($conn));
} else {
$rows = array();
while ($row = $result->fetch_assoc()) {
$rows[] = $row;
}
/* $rows = mysqli_fetch_all($result, MYSQLI_ASSOC); */
$json = json_encode($rows);
//This function returns the JSON representation of a value on success or FALSE on failure.
}
mysqli_free_result($result);
//The mysqli_free_result() function frees the memory associated with the result
$conn->close();
$dejson = json_decode($json);
$_SESSION["GET_USERNAME"] = $dejson[0]->{'userName'};
$_SESSION["GET_FIRSTNAME"] = $dejson[0]->{'firstName'};
$_SESSION["GET_LASTNAME"] = $dejson[0]->{'lastName'};
$_SESSION["GET_STAFFID"] = $dejson[0]->{'staffId'};
$_SESSION["GET_DESIGNATION"] = $dejson[0]->{'designation'};
$_SESSION["GET_EMAILID"] = $dejson[0]->{'email_Id'};
$_SESSION["GET_PHONE"] = $dejson[0]->{'phoneNumber'};
return $json;
}
示例9: comprobarPosicion
function comprobarPosicion($LOGIN, $COLUMNA, $FILA, $TAMANYO, $ANGULO)
{
global $link, $DIVISIONES;
if ($ANGULO == 0 && $COLUMNA + $TAMANYO > $DIVISIONES || $ANGULO == -90 && $FILA - $TAMANYO < 1) {
return false;
}
$mysql = 'select * from barco where LOGIN="' . $LOGIN . '"';
if ($res = mysqli_query($link, $mysql)) {
while ($row = mysqli_fetch_assoc($res)) {
for ($i = 0; $i < $TAMANYO; $i++) {
$C = $COLUMNA;
$F = $FILA;
if ($ANGULO == 0) {
$C = $C + $i;
} else {
$F = $F - $i;
}
if ($row['ANGULO'] == 0 && $C >= $row['COLUMNA'] - 1 && $C <= $row['COLUMNA'] + $row['TAMANYO'] && $F <= $row['FILA'] + 1 && $F >= $row['FILA'] - 1 || $row['ANGULO'] == -90 && $F <= $row['FILA'] + 1 && $F >= $row['FILA'] - $row['TAMANYO'] && $C >= $row['COLUMNA'] - 1 && $C <= $row['COLUMNA'] + 1) {
return false;
}
}
// for($i=0;$i<$TAMANYO;$i++)
}
mysqli_free_result($res);
}
return true;
}
示例10: Decider
function Decider($dname, $dmail)
{
$name = $dname;
$mail = strtolower($dmail);
//connect to the database
$con = mysqli_connect("eu-cdbr-azure-west-a.cloudapp.net", "b8592f1b44ff9a", "fecb2128", "TeamProject");
$name = mysqli_real_escape_string($con, $name);
if (mysqli_connect_errno()) {
return "f";
}
$query = "SELECT Email FROM Subscriber WHERE Email='" . $mail . "'";
$result = mysqli_query($con, $query);
if (mysqli_num_rows($result) > 0) {
$result = Unsub($mail);
} else {
if (empty($mail)) {
$result = Unsub($name);
} else {
$result = Subscribe($name, $mail);
}
}
// Free result set
mysqli_free_result($result);
mysqli_close($con);
return $result;
}
示例11: execute
/**
* Wykonaniew zapytania do bazy
*
* @param sqlQuery obiekt typu SqlQuery
* @return wynik zapytania
*/
public static function execute($sqlQuery)
{
$transaction = Transaction::getCurrentTransaction();
if (!$transaction) {
$connection = new Connection();
} else {
$connection = $transaction->getConnection();
}
$query = $sqlQuery->getQuery();
// $pos = strpos($query, "null");
// if ($pos != false) {
// if(true) {
// writeToFile($query);
// }
// }
$result = $connection->executeQuery($query);
if (!$result) {
throw new Exception("SQL Error: -->" . $query . "<--" . mysql_error());
}
$i = 0;
$tab = array();
while ($row = mysqli_fetch_array($result)) {
$tab[$i++] = $row;
}
mysqli_free_result($result);
if (!$transaction) {
$connection->close();
}
return $tab;
}
示例12: hisdb_hasDoctorAccount
function hisdb_hasDoctorAccount($dbConn, $doctorid)
{
$recordSet = mysqli_query($dbConn, 'SELECT LoginUserID ' . 'FROM Doctor ' . 'WHERE DoctorID = \'' . $doctorid . '\';');
$record = mysqli_fetch_array($recordSet, MYSQLI_ASSOC);
mysqli_free_result($recordSet);
return $record['LoginUserID'];
}
示例13: dbReadRow
function dbReadRow($sql)
{
$result = dbGetQueryResult($sql);
$row = mysqli_fetch_array($result);
mysqli_free_result($result);
return $row;
}
示例14: get_data
function get_data($sql, $db = NULL)
{
if ($db == NULL) {
$db = db();
}
$GLOBALS['LP_LAST_SQL'] = $sql;
$data = array();
$i = 0;
$result = mysqli_query($db, $sql);
if (mysqli_errno($db) != 0) {
echo mysqli_error($db) . ' ' . $sql;
}
while ($Array = mysqli_fetch_array($result, MYSQL_ASSOC)) {
$data[$i++] = $Array;
}
if (mysqli_errno($db) != 0) {
echo mysqli_error($db) . ' ' . $sql;
}
mysqli_free_result($result);
if (count($data) > 0) {
return $data;
} else {
return false;
}
}
示例15: getCorreoIntegrantes
function getCorreoIntegrantes($fechaInicio, $fechaFin)
{
include '../Conexion.php';
$ConexionBD = new Conexion();
$database = $ConexionBD::conectarBD();
if ($database->connect_errno) {
$data = NULL;
} else {
$sqlSelect = ' SELECT intCorreo';
$sqlFrom = ' FROM integrantes ';
$sqlWhere = ' WHERE intActivo = TRUE ';
$sqlOrder = ' ORDER BY intCorreo;';
$consulta = $sqlSelect . $sqlFrom . $sqlWhere . $sqlOrder;
if ($result = $database->query($consulta)) {
if ($result->num_rows > 0) {
$i = 0;
while ($row = mysqli_fetch_array($result, MYSQL_BOTH)) {
$intCorreo = $row['intCorreo'];
$data[] = array('intCorreo' => $intCorreo);
$i++;
}
// return $data
mysqli_free_result($resultado);
} else {
$data = NULL;
}
$result->close();
}
$ConexionBD::desconectarDB($database);
}
// echo $fechaFin;
return $data;
}