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


PHP mysqli_stmt_store_result函数代码示例

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


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

示例1: createExtFile

function createExtFile($type)
{
    $pathOfExt = "C:/data/ext/";
    $pathOfDatabase = "C:/data/database/";
    $t = time();
    $temp_id = array();
    $con = mysqli_connect("localhost", "root", "1212312121", "proj4d");
    mysqli_set_charset($con, "utf8");
    $query = "SELECT id FROM " . $type . "_detail WHERE isValid = 1";
    $statement = mysqli_prepare($con, $query);
    $success = mysqli_stmt_execute($statement);
    mysqli_stmt_store_result($statement);
    mysqli_stmt_bind_result($statement, $id);
    $path = $pathOfExt . $type . $t . ".ext";
    $myfile = fopen($path, "w") or die("Unable to open file!");
    while (mysqli_stmt_fetch($statement)) {
        array_push($temp_id, $id);
    }
    $i = 0;
    for ($i; $i < sizeof($temp_id) - 1; $i++) {
        $id = $temp_id[$i];
        $txt = $pathOfDatabase . $type . "/" . $id . "/1.png;" . $id . PHP_EOL;
        fwrite($myfile, $txt);
        $txt = $pathOfDatabase . $type . "/" . $id . "/2.png;" . $id . PHP_EOL;
        fwrite($myfile, $txt);
    }
    $id = $temp_id[$i];
    $txt = $pathOfDatabase . $type . "/" . $id . "/1.png;" . $id . PHP_EOL;
    fwrite($myfile, $txt);
    $txt = $pathOfDatabase . $type . "/" . $id . "/2.png;" . $id;
    fwrite($myfile, $txt);
    fclose($myfile);
    return $type . $t . ".ext";
}
开发者ID:paratab,项目名称:Proj_ImgApp,代码行数:34,代码来源:ImageExeCalling.php

示例2: checkrows

function checkrows()
{
    include "components/db_connect.php";
    $username = $_POST['email'];
    $x = "select * from details where email='{$username}'";
    $result = mysqli_prepare($con, $x);
    mysqli_stmt_execute($result);
    mysqli_stmt_store_result($result);
    $y = mysqli_stmt_num_rows($result);
    include "components/db_disconnect.php";
    return $y;
}
开发者ID:ncs-jss,项目名称:newMCQ-,代码行数:12,代码来源:register.php

示例3: registrator

function registrator($link)
{
    //Функция регистрации пользователя (Взято из интернета "редактированно")
    if (!empty($_POST["submit"])) {
        if (!preg_match("/^[a-zA-Z0-9]+\$/", $_POST['login'])) {
            $err[] = "Логин может состоять только из букв английского алфавита и цифр<br>";
        }
        if (strlen($_POST['login']) < 3 or strlen($_POST['login']) > 30) {
            $err[] = "Логин должен быть не меньше 3-х символов и не больше 30<br>";
        }
        $query = "SELECT COUNT(user_id) FROM users WHERE user_login='" . mysqli_real_escape_string($link, $_POST['login']) . "'";
        if ($stmt = mysqli_prepare($link, $query)) {
            mysqli_stmt_execute($stmt);
            mysqli_stmt_bind_result($stmt, $user_id);
            mysqli_stmt_store_result($stmt);
            mysqli_stmt_fetch($stmt);
            mysqli_stmt_close($stmt);
        }
        if (!$user_id == 0) {
            $err[] = "Пользователь с таким логином уже существует в базе данных<br>";
        }
        if (count($err) == 0) {
            $login = $_POST['login'];
            $password = md5(md5(trim($_POST['password'])));
            mysqli_query($link, "INSERT INTO users SET user_login='" . $login . "', user_password='" . $password . "'");
            header("Location: login.php");
            exit;
        } else {
            print "<b>При регистрации произошли следующие ошибки:</b><br>";
            foreach ($err as $error) {
                print $error . "<br>";
            }
        }
    }
}
开发者ID:Latinoz,项目名称:shop_catalog,代码行数:35,代码来源:lib.inc.php

示例4: login

function login()
{
    include_once 'database_conn.php';
    // check is form filled
    if (isFormFilled()) {
        // if not filled, stop
        return;
    }
    $uid = sanitizeData($_POST['username']);
    $pswd = sanitizeData($_POST['password']);
    $columnLengthSql = "\n\t\t\tSELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH\n\t\t\tFROM INFORMATION_SCHEMA.COLUMNS\n\t\t\tWHERE TABLE_NAME =  'te_users'\n\t\t\tAND (column_name =  'username'\n\t\t\tOR column_name =  'passwd')";
    $COLUMN_LENGTH = getColumnLength($conn, $columnLengthSql);
    $isError = false;
    $errMsg[] = validateStringLength($uid, $COLUMN_LENGTH['username']);
    //uid
    $errMsg[] = validateStringLength($pswd, $COLUMN_LENGTH['passwd']);
    //pswd
    for ($i = 0; $i < count($errMsg); $i++) {
        if (!($errMsg[$i] === true)) {
            echo "{$errMsg[$i]}";
            $isError = true;
        }
    }
    //if contain error, halt continue executing the code
    if ($isError) {
        return;
    }
    // check is uid exist
    $checkUIDSql = "SELECT passwd, salt FROM te_users WHERE username = ?";
    $stmt = mysqli_prepare($conn, $checkUIDSql);
    mysqli_stmt_bind_param($stmt, "s", $uid);
    mysqli_stmt_execute($stmt);
    mysqli_stmt_store_result($stmt);
    if (mysqli_stmt_num_rows($stmt) <= 0) {
        echo "Sorry we don't seem to have that username.";
        return;
    }
    mysqli_stmt_bind_result($stmt, $getHashpswd, $getSalt);
    while (mysqli_stmt_fetch($stmt)) {
        $hashPswd = $getHashpswd;
        $salt = $getSalt;
    }
    // if exist, then get salt and db hashed password
    // create hash based on password
    // hash pswd using sha256 algorithm
    // concat salt in db by uid
    // hash using sha256 algorithm
    $pswd = hash("sha256", $salt . hash("sha256", $pswd));
    // check does it match with hased password from db
    if (strcmp($pswd, $hashPswd) === 0) {
        echo "Success login<br/>";
        // add session
        $_SESSION['logged-in'] = $uid;
        // go to url
        $url = $_SERVER['REQUEST_URI'];
        header("Location: {$url}");
    } else {
        echo "Fail login<br/>";
    }
}
开发者ID:lowjiayou,项目名称:YearTwoWebOne,代码行数:60,代码来源:login.php

示例5: test_format

function test_format($link, $format, $from, $order_by, $expected, $offset)
{
    if (!($stmt = mysqli_stmt_init($link))) {
        printf("[%03d] Cannot create PS, [%d] %s\n", $offset, mysqli_errno($link), mysqli_error($link));
        return false;
    }
    if ($order_by) {
        $sql = sprintf('SELECT %s AS _format FROM %s ORDER BY %s', $format, $from, $order_by);
    } else {
        $sql = sprintf('SELECT %s AS _format FROM %s', $format, $from);
    }
    if (!mysqli_stmt_prepare($stmt, $sql)) {
        printf("[%03d] Cannot prepare PS, [%d] %s\n", $offset + 1, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
        return false;
    }
    if (!mysqli_stmt_execute($stmt)) {
        printf("[%03d] Cannot execute PS, [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
        return false;
    }
    if (!mysqli_stmt_store_result($stmt)) {
        printf("[%03d] Cannot store result set, [%d] %s\n", $offset + 3, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
        return false;
    }
    if (!is_array($expected)) {
        $result = null;
        if (!mysqli_stmt_bind_result($stmt, $result)) {
            printf("[%03d] Cannot bind result, [%d] %s\n", $offset + 4, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
            return false;
        }
        if (!mysqli_stmt_fetch($stmt)) {
            printf("[%03d] Cannot fetch result,, [%d] %s\n", $offset + 5, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
            return false;
        }
        if ($result !== $expected) {
            printf("[%03d] Expecting %s/%s got %s/%s with %s - %s.\n", $offset + 6, gettype($expected), $expected, gettype($result), $result, $format, $sql);
        }
    } else {
        $order_by_col = $result = null;
        if (!mysqli_stmt_bind_result($stmt, $order_by_col, $result)) {
            printf("[%03d] Cannot bind result, [%d] %s\n", $offset + 7, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
            return false;
        }
        reset($expected);
        while ((list($k, $v) = each($expected)) && mysqli_stmt_fetch($stmt)) {
            if ($result !== $v) {
                printf("[%03d] Row %d - expecting %s/%s got %s/%s [%s] with %s - %s.\n", $offset + 8, $k, gettype($v), $v, gettype($result), $result, $order_by_col, $format, $sql);
            }
        }
    }
    mysqli_stmt_free_result($stmt);
    mysqli_stmt_close($stmt);
    return true;
}
开发者ID:gleamingthecube,项目名称:php,代码行数:53,代码来源:ext_mysqli_tests_mysqli_stmt_bind_result_format.php

示例6: verificaMesGrafico

function verificaMesGrafico($string)
{
    include "conf-conexao.php";
    include "script-time.php";
    // selecione o total de meses quando ano for igua a anoCorrente
    $consultaSqlVerificaMes = "SELECT MES FROM tab_dados_grafico WHERE MES LIKE  '%{$string}%' AND ANO = {$anoCorrente}";
    $stmt = mysqli_prepare($conexao, $consultaSqlVerificaMes);
    if ($stmt) {
        mysqli_stmt_execute($stmt);
        mysqli_stmt_store_result($stmt);
        echo mysqli_stmt_num_rows($stmt);
    }
}
开发者ID:thalysssonNascimento,项目名称:grafico-chart,代码行数:13,代码来源:verificaMesGrafico.php

示例7: getUserData

function getUserData($uid)
{
    global $db;
    $stmt = mysqli_prepare($db, "SELECT\n                username,\n                firstname,\n                lastname,\n                email,\n                profileimg,\n                UNIX_TIMESTAMP( registertime )\n            FROM users\n            WHERE uid = ?\n            LIMIT 1\n            ");
    mysqli_stmt_bind_param($stmt, "s", $uid);
    mysqli_stmt_execute($stmt);
    mysqli_stmt_store_result($stmt);
    mysqli_stmt_bind_result($stmt, $username, $firstname, $lastname, $email, $img, $time);
    if (mysqli_stmt_fetch($stmt) == NULL) {
        return false;
    }
    $retData = ['userid' => $uid, 'username' => $username, 'firstname' => $firstname, 'lastname' => $lastname, 'email' => $email, 'img' => $img, 'registerTime' => $time];
    return $retData;
}
开发者ID:AlexandrosKal,项目名称:mylib,代码行数:14,代码来源:user_functions.php

示例8: getAllActivitiesByUser

function getAllActivitiesByUser($params)
{
    $connection = dbConnect();
    $options = ['columns' => 'a.id, ud.nome as demandante, s.sigla,
        sa.status, a.titulo, a.data, a.tempo_gasto, a.id_status', 'join' => [['type' => 'INNER JOIN', 'table' => 'setores s', 'columns' => 's.id = a.id_setor'], ['type' => 'INNER JOIN', 'table' => 'status_atividade sa', 'columns' => 'sa.id = a.id_status'], ['type' => 'INNER JOIN', 'table' => 'usuarios ud', 'columns' => 'ud.id = a.id_demandante']], 'where' => ['a.id_responsavel' => $_SESSION['id']], 'order_by' => 'a.data DESC', 'limit' => $params['limit'] . ', ' . $params['offset']];
    $sql = buildSelect('atividades a', $options);
    $stmt = mysqli_prepare($connection, $sql);
    mysqli_stmt_bind_param($stmt, 'i', $_SESSION['id']);
    mysqli_stmt_execute($stmt);
    mysqli_stmt_store_result($stmt);
    mysqli_stmt_bind_result($stmt, $id, $demandante, $sigla, $status, $titulo, $data, $tempo_gasto, $id_status);
    $result = [];
    while (mysqli_stmt_fetch($stmt)) {
        array_push($result, ["id" => $id, "demandante" => $demandante, "sigla" => $sigla, "status" => $status, "titulo" => $titulo, "data" => $data, "tempo_gasto" => $tempo_gasto, "id_status" => $id_status]);
    }
    $numRows = mysqli_stmt_num_rows($stmt);
    mysqli_stmt_close($stmt);
    dbClose($connection);
    return ['result' => $result, 'numRows' => $numRows];
}
开发者ID:Calcio,项目名称:CursoPHPBasico,代码行数:20,代码来源:queries.php

示例9: func_test_mysqli_stmt_num_rows

function func_test_mysqli_stmt_num_rows($stmt, $query, $expected, $offset)
{
    if (!mysqli_stmt_prepare($stmt, $query)) {
        printf("[%03d] [%d] %s\n", $offset, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
        return false;
    }
    if (!mysqli_stmt_execute($stmt)) {
        printf("[%03d] [%d] %s\n", $offset + 1, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
        return false;
    }
    if (!mysqli_stmt_store_result($stmt)) {
        printf("[%03d] [%d] %s\n", $offset + 2, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
        return false;
    }
    if ($expected !== ($tmp = mysqli_stmt_num_rows($stmt))) {
        printf("[%03d] Expecting %s/%d, got %s/%d\n", $offset + 3, gettype($expected), $expected, gettype($tmp), $tmp);
    }
    mysqli_stmt_free_result($stmt);
    return true;
}
开发者ID:gleamingthecube,项目名称:php,代码行数:20,代码来源:ext_mysqli_tests_mysqli_stmt_num_rows.php

示例10: accountExists

function accountExists()
{
    $link = mysqli_connect("host_name", "username", "password", "database") or die("Database connection failed - " . mysqli_error($link));
    $sql = "SELECT COUNT(*) AS count FROM user WHERE username = UPPER(?) ";
    if ($stmt = mysqli_prepare($link, $sql)) {
        $user = $_POST['username'];
        mysqli_stmt_bind_param($stmt, "s", $user) or die("bind param");
        mysqli_stmt_execute($stmt);
        mysqli_stmt_bind_result($stmt, $count);
        mysqli_stmt_store_result($stmt);
        mysqli_stmt_fetch($stmt);
    } else {
        die("prepare failed");
    }
    mysqli_stmt_close($stmt);
    mysqli_close($link);
    if ($count == "1") {
        return true;
    }
    return false;
}
开发者ID:nzewiski,项目名称:cs3380-groupproject-public,代码行数:21,代码来源:common.php

示例11: prepareNotificationOneClueOneNotice

function prepareNotificationOneClueOneNotice($clue_id, $notice_id)
{
    $con = mysqli_connect("localhost", "root", "1212312121", "proj4d");
    mysqli_set_charset($con, "utf8");
    $notify_data = array();
    $notify_ids = array();
    $adder_notice = array();
    $query = "SELECT A.adder, A.name, B.token FROM notice_detail AS A, gcm_token_list AS B WHERE A.id = ? AND A.adder = B.username";
    $statement = mysqli_prepare($con, $query);
    mysqli_stmt_bind_param($statement, "s", $notice_id);
    $success = mysqli_stmt_execute($statement);
    mysqli_stmt_store_result($statement);
    mysqli_stmt_bind_result($statement, $adder, $lostName, $token);
    mysqli_stmt_fetch($statement);
    array_push($notify_ids, $token);
    $adder_notice["" . $adder] = "" . $notice_id . "," . $lostName;
    $notify_data["clue_id"] = $clue_id;
    $notify_data["notice_id_data"] = json_encode($adder_notice);
    mysqli_stmt_close($statement);
    mysqli_close($con);
    return sendGoogleCloudMessage($notify_data, $notify_ids);
}
开发者ID:paratab,项目名称:Proj_ImgApp,代码行数:22,代码来源:NotificationCenter.php

示例12: get_key

function get_key($dbh, $config, $key)
{
    $data = array();
    $result = 0;
    $stmt = mysqli_prepare($dbh, "SELECT name,try_interval,last_try FROM " . $config['table_prefix'] . "keys WHERE `key` = ? LIMIT 0,1");
    mysqli_stmt_bind_param($stmt, "s", $key);
    mysqli_stmt_execute($stmt);
    mysqli_stmt_store_result($stmt);
    $result = mysqli_stmt_num_rows($stmt);
    mysqli_stmt_bind_result($stmt, $name, $try_interval, $last_try);
    while (mysqli_stmt_fetch($stmt)) {
        $data['name'] = $name;
        $data['try_interval'] = $try_interval;
        $data['last_try'] = $last_try;
    }
    mysqli_stmt_close($stmt);
    unset($stmt);
    if ($result) {
        return $data;
    } else {
        return 0;
    }
}
开发者ID:basvdburg,项目名称:php-notify-telegram,代码行数:23,代码来源:functions.php

示例13: getDocID

function getDocID($url)
{
    $con = $GLOBALS["con"];
    $sql = "SELECT docID FROM documents WHERE URL=?";
    $stmt = mysqli_prepare($con, $sql) or die(mysqli_error($con));
    mysqli_stmt_bind_param($stmt, 's', $url) or die(mysqli_stmt_error($stmt));
    mysqli_stmt_execute($stmt) or die(mysqli_stmt_error($stmt));
    mysqli_stmt_store_result($stmt);
    if (mysqli_stmt_num_rows($stmt) < 1) {
        mysqli_stmt_close($stmt);
        $sql = "INSERT INTO documents (URL) VALUES (?)";
        $stmt = mysqli_prepare($con, $sql) or die(mysqli_error($con));
        mysqli_stmt_bind_param($stmt, 's', $url) or die(mysqli_stmt_error($stmt));
        mysqli_stmt_execute($stmt) or die(mysqli_stmt_error($stmt));
        mysqli_stmt_bind_result($stmt, $docID);
        mysqli_stmt_fetch($stmt);
        return getDocID($url);
    } else {
        mysqli_stmt_bind_result($stmt, $docID);
        mysqli_stmt_fetch($stmt);
        return $docID;
    }
}
开发者ID:jreinstra,项目名称:dragonfly-main,代码行数:23,代码来源:download.php

示例14: getBookDetails

function getBookDetails($bid)
{
    global $db;
    $stmt = mysqli_prepare($db, 'SELECT
                books.title,
                books.description,
                bookauthors.name,
                genres.name,
                books.coverimage
            FROM
                books CROSS
                JOIN bookgenres ON bookgenres.bid = books.bid CROSS
                JOIN genres ON genres.id = bookgenres.genreid CROSS
                JOIN bookauthors ON bookauthors.bid = books.bid
            WHERE
                books.bid = ?
            ');
    mysqli_stmt_bind_param($stmt, 'i', $bid);
    mysqli_stmt_execute($stmt);
    mysqli_stmt_store_result($stmt);
    mysqli_stmt_bind_result($stmt, $title, $description, $author, $genre, $image);
    $results = false;
    while (mysqli_stmt_fetch($stmt)) {
        $results = true;
        $book['title'] = $title;
        $book['description'] = $description;
        $book['authors'][$author] = true;
        $book['genres'][$genre] = true;
        $book['image'] = $image;
        $book['bid'] = $bid;
    }
    if (!$results) {
        return false;
    }
    return $book;
}
开发者ID:AlexandrosKal,项目名称:mylib,代码行数:36,代码来源:show_book_functions.php

示例15: printf

    printf("[040] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
}
/* try to use stmt_affected_rows like stmt_num_rows */
/* stmt_affected_rows is not really meant for SELECT! */
if (mysqli_stmt_prepare($stmt, 'SELECT unknown_column FROM this_table_does_not_exist') || mysqli_stmt_execute($stmt)) {
    printf("[041] The invalid SELECT statement is issued on purpose\n");
}
if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) {
    printf("[042] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
}
if ($IS_MYSQLND) {
    if (false !== ($tmp = mysqli_stmt_store_result($stmt))) {
        printf("[043] Expecting boolean/false, got %s\\%s\n", gettype($tmp), $tmp);
    }
} else {
    if (true !== ($tmp = mysqli_stmt_store_result($stmt))) {
        printf("[043] Libmysql does not care if the previous statement was bogus, expecting boolean/true, got %s\\%s\n", gettype($tmp), $tmp);
    }
}
if (0 !== ($tmp = mysqli_stmt_num_rows($stmt))) {
    printf("[044] Expecting int/0, got %s/%s\n", gettype($tmp), $tmp);
}
if (-1 !== ($tmp = mysqli_stmt_affected_rows($stmt))) {
    printf("[045] Expecting int/-1, got %s/%s\n", gettype($tmp), $tmp);
}
mysqli_stmt_close($stmt);
$stmt = mysqli_stmt_init($link);
if (!mysqli_stmt_prepare($stmt, "DROP TABLE IF EXISTS test_mysqli_stmt_affected_rows_table_1") || !mysqli_stmt_execute($stmt)) {
    printf("[046] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
}
mysqli_stmt_close($stmt);
开发者ID:alphaxxl,项目名称:hhvm,代码行数:31,代码来源:mysqli_stmt_affected_rows.php


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