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


PHP mysqli_stmt_execute函数代码示例

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


在下文中一共展示了mysqli_stmt_execute函数的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: EliminarMarca

 public function EliminarMarca($marca)
 {
     $mysqli = $this->mysqli;
     $stmt = \mysqli_prepare($mysqli, "CALL ELIMINAR_MARCA(?)");
     \mysqli_stmt_bind_param($stmt, 'i', $marca);
     \mysqli_stmt_execute($stmt);
 }
开发者ID:keua,项目名称:DeGuate,代码行数:7,代码来源:CL_MARCA.php

示例3: execute

 public function execute($sql)
 {
     global $registry;
     $link = $registry->get("dl");
     $res = mysqli_query($link, $sql);
     mysqli_stmt_execute($res);
 }
开发者ID:fire-coding,项目名称:gis,代码行数:7,代码来源:db.php

示例4: saveAction

/**
 * Save data
 * @param   array   Request data (unfiltered)
 */
function saveAction($request)
{
    require_once 'config.php';
    //connection:
    $link = mysqli_connect($servidor, $user, $pass, $database) or die("Error " . mysqli_error($link));
    $flag = 'false';
    $param = $request;
    $idUrl = mysqli_real_escape_string($link, $param['idUrl']);
    $dataPost = isset($param['data']) ? $param['data'] : false;
    $idPage = _checkIdUrl($link, $idUrl);
    if ($idPage > 0 && is_array($dataPost) && count($dataPost) > 0) {
        $reg = formarDataToSerial($idPage, $dataPost);
        $reg['page_id'] = intval($reg['page_id']);
        $reg['browser_id'] = $reg['browser_id'];
        $reg['view_port'] = mysqli_real_escape_string($link, $reg['view_port']);
        $reg['window_browser'] = mysqli_real_escape_string($link, $reg['window_browser']);
        $reg['screen'] = mysqli_real_escape_string($link, $reg['screen']);
        $query = "INSERT INTO heatmap (page_id, browser_id, view_port, window_browser, screen, data_serial, created_at) " . "VALUES ('" . $reg['page_id'] . "', '" . $reg['browser_id'] . "','" . $reg['view_port'] . "','" . $reg['window_browser'] . "','" . $reg['screen'] . "', '" . $reg['data_serial'] . "', '" . date('Y-m-d H:i:s') . "')";
        $stmt = mysqli_prepare($link, $query);
        mysqli_stmt_execute($stmt);
        mysqli_stmt_close($stmt);
        $flag = 'true';
    }
    mysqli_close($link);
    echo $flag;
}
开发者ID:beeznest,项目名称:heatmap,代码行数:30,代码来源:controller.php

示例5: email

function email()
{
    global $link, $stmt;
    if (defined("CRYPT_BLOWFISH") && CRYPT_BLOWFISH) {
        $salt = '$2y$11$' . substr(md5(uniqid(rand(), true)), 0, 22);
        $password = crypt($_POST['password'], $salt);
    }
    mysqli_stmt_bind_param($stmt, 'ss', $_POST['email'], $password);
    mysqli_stmt_execute($stmt);
    mysqli_stmt_close($stmt);
    //to verify email
    $hash = hash('md5', $_POST["email"]);
    $stmt = mysqli_prepare($link, "INSERT INTO `verify_email`(`email`, `hash`) VALUES(?,'" . $hash . "')") or die(mysqli_error($link));
    mysqli_stmt_bind_param($stmt, 's', $_POST['email']);
    mysqli_stmt_execute($stmt);
    mysqli_stmt_close($stmt);
    mysqli_close($link);
    $to = $_POST['email'];
    $subject = 'Email varification';
    $message = 'Please click this link to activate your account: http://woofwarrior.com//gallery/verify.php?email=' . $_POST['email'] . '&hash=' . $hash . ' ';
    $headers = "From: activation@woofwarrior.com\r\n";
    mail($to, $subject, $message, $headers);
    //echo json_encode('signed up, verify email. Please click this link to activate your account: http://woofwarrior.com//gallery/htdocs/verify.php?email='.$_POST['email'].'&hash='.$hash);
    echo json_encode('verify email');
}
开发者ID:tinggao,项目名称:woofWarrior,代码行数:25,代码来源:signup.php

示例6: isInQueue

function isInQueue()
{
    // Reference Global Variables
    global $globalHostName;
    global $globalUserName;
    global $globalPassword;
    global $globalDatabase;
    // MySQL Connection
    $connection = mysqli_connect($globalHostName, $globalUserName, $globalPassword, $globalDatabase);
    // Connection Error Handling
    if ($connection->connect_error) {
        // Kill the Connection
        die("Could Not Connect to the Database");
    }
    // MySQL Injection Neutralized Email Variable
    $safeEmail = mysqli_real_escape_string($connection, $_REQUEST['inputEmail']);
    // Query Preparation
    $query = mysqli_prepare($connection, 'SELECT COUNT(*) as total FROM users WHERE email = ?');
    $query->bind_param('s', $safeEmail);
    // Query Execution
    mysqli_stmt_execute($query);
    // Query Result Analysis
    mysqli_stmt_bind_result($query, $total);
    $data = mysqli_stmt_fetch($query);
    //-----
    $connection->close();
    // If That Email is Already Registered...
    if ($total > 0) {
        echo "true";
        return true;
    } else {
        echo "false";
        return false;
    }
}
开发者ID:hkuchampudi,项目名称:AutomatedExchangeSystem,代码行数:35,代码来源:inQueue.php

示例7: EliminarTienda

 public function EliminarTienda($tienda)
 {
     $mysqli = $this->mysqli;
     $stmt = \mysqli_prepare($mysqli, "CALL ELIMINAR_TIENDA(?);");
     \mysqli_stmt_bind_param($stmt, 'i', $tienda);
     \mysqli_stmt_execute($stmt);
 }
开发者ID:keua,项目名称:DeGuate,代码行数:7,代码来源:CL_TIENDA.php

示例8: EliminarUsuario

 public function EliminarUsuario($ID)
 {
     $mysqli = $this->mysqli;
     $stmt = \mysqli_prepare($mysqli, "CALL ELIMINAR_ADMIN(?)");
     \mysqli_stmt_bind_param($stmt, 'i', $ID);
     \mysqli_stmt_execute($stmt);
 }
开发者ID:keua,项目名称:DeGuate,代码行数:7,代码来源:CL_USUARIO.php

示例9: insertAgent

function insertAgent($agtdata)
{
    //SQL connection variables
    $servername = "localhost";
    $username = "root";
    $password = "";
    $dbname = "travelexperts";
    //myslqi connection and prepared statement
    $dbh = @mysqli_connect($servername, $username, $password) or die("Connect Error: " . mysqli_connect_error());
    mysqli_select_db($dbh, $dbname);
    $colnames = array_keys($agtdata);
    $colnamestring = implode(", ", $colnames);
    $sql = "insert into agents ({$colnamestring}) values (?, ?, ?, ?, ?, ?, ?, ?, ?)";
    //number of ? needs to match the number of fields
    $stmt = mysqli_prepare($dbh, $sql);
    $values = array_values($agtdata);
    mysqli_stmt_bind_param($stmt, "ssssssiss", $values[0], $values[1], $values[2], $values[3], $values[4], $values[5], $values[6], $values[7], $values[8]);
    // the number of s or i (string or int or other) needs to match the number and type of fields
    $result = mysqli_stmt_execute($stmt);
    //print(mysqli_error($dbh));
    //print("result=$result");
    //print($sql);
    mysqli_close($dbh);
    //Return messages if successful or unsuccessful
    if ($result) {
        return "A new agent account was created successfully<br />";
    } else {
        return "Failed to create new agent account<br />";
    }
}
开发者ID:bogiesoft,项目名称:TravelSite,代码行数:30,代码来源:functions.php

示例10: update_last_try

function update_last_try($dbh, $config, $key)
{
    $stmt = mysqli_prepare($dbh, "UPDATE " . $config['table_prefix'] . "keys SET last_try = NOW() WHERE `key` = ?");
    mysqli_stmt_bind_param($stmt, "s", $key);
    mysqli_stmt_execute($stmt);
    mysqli_stmt_close($stmt);
}
开发者ID:basvdburg,项目名称:php-notify-telegram,代码行数:7,代码来源:functions.php

示例11: 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

示例12: update_vote

function update_vote($image_id)
{
    //get number of votes and update
    global $link;
    /*$result = mysqli_query($link, "SELECT `amount` FROM `votes_amount` WHERE `imageID`=".$image_id.";") or die(mysqli_error($link));
    	$amount = mysqli_fetch_assoc($result);
    	$new_amount = $amount['amount']+1;
    	mysqli_query($link, "UPDATE `votes_amount` SET `amount`=".$new_amount." WHERE `imageID`=".$image_id.";") or die(mysqli_error($link));*/
    $stmt = mysqli_stmt_init($link);
    mysqli_stmt_prepare($stmt, "SELECT `amount` FROM `votes_amount` WHERE `imageID`=?;") or die(mysqli_error($link));
    mysqli_stmt_bind_param($stmt, 'i', $image_id);
    mysqli_stmt_execute($stmt);
    $result = mysqli_stmt_get_result($stmt);
    mysqli_stmt_close($stmt);
    $amount = mysqli_fetch_assoc($result);
    $new_amount = $amount['amount'] + 1;
    $stmt = mysqli_prepare($link, "UPDATE `votes_amount` SET `amount`=" . $new_amount . " WHERE `imageID`=?;") or die(mysqli_error($link));
    mysqli_stmt_bind_param($stmt, 'i', $image_id);
    mysqli_stmt_execute($stmt);
    mysqli_stmt_close($stmt);
    //return ajax data
    if (isset($_SESSION['id']) && !isset($_POST['action']) && !isset($_POST['votePic'])) {
        $data = array('new_amount' => $new_amount, 'imageID' => $image_id);
    } elseif (isset($_POST['action']) && $_POST['action'] == 'anonymous_voting') {
        //get another two images
        $result = mysqli_query($link, "SELECT * FROM `image` ORDER BY RAND() LIMIT 2;") or die(mysqli_error($link));
        $data = array();
        while ($row = mysqli_fetch_assoc($result)) {
            $data[] = $row;
        }
    }
    mysqli_close($link);
    return $data;
}
开发者ID:tinggao,项目名称:woofWarrior,代码行数:34,代码来源:vote.php

示例13: insertItems

 public function insertItems(Items $items)
 {
     $con = self::openConnection();
     $affected = 0;
     mysqli_begin_transaction($con);
     $stm = mysqli_stmt_init($con);
     $sql = "INSERT INTO category VALUES (?, ?, ?)";
     mysqli_stmt_prepare($stm, $sql);
     foreach ($items->getItems() as $item) {
         $code = $item->getCode();
         $name = $item->getName();
         $parent = $item->getParent() == null ? null : $item->getParent()->getCode();
         mysqli_stmt_bind_param($stm, 'sss', $code, $name, $parent);
         mysqli_stmt_execute($stm);
         if (mysqli_affected_rows($con) == 1) {
             $affected++;
         }
     }
     if ($affected > 0) {
         mysqli_commit($con);
     } else {
         mysqli_rollback($con);
     }
     return $affected;
 }
开发者ID:Voww,项目名称:PHP_test_tasks,代码行数:25,代码来源:CategoryDAO.php

示例14: saveimage

function saveimage($name, $image)
{
    $con = mysqli_connect("localhost", "root", "root", "Alegatori") or die("Error " . mysqli_error($link));
    $qry = "INSERT INTO Candidati (Nume,Voturi,Poza,Sfarsit) VALUES ('{$name}',0,'{$image}',0)";
    $stmt = mysqli_prepare($con, $qry);
    mysqli_stmt_execute($stmt);
}
开发者ID:BogdanVM,项目名称:La-Vot-,代码行数:7,代码来源:Adaugare.php

示例15: query

 public function query($sql, $values = array())
 {
     $sql = new Expressions($sql);
     $sql->set_connection($this);
     $sql->bind_values($values);
     $sql = trim($sql->to_s());
     $values = $values ? array_flatten($values) : array();
     if (!($sth = mysqli_prepare($this->connection, $sql))) {
         throw new DatabaseException(mysqli_error($this->connection), mysqli_errno($this->connection));
     }
     if (count($values) > 0) {
         $params = array($sth, '');
         foreach ($values as &$value) {
             if (is_int($value)) {
                 $params[1] .= 'i';
             } elseif (is_float($value)) {
                 $params[1] .= 'd';
             } else {
                 $params[1] .= 's';
             }
             $params[] =& $value;
         }
         if ($params[1]) {
             call_user_func_array('mysqli_stmt_bind_param', $params);
         }
     }
     if (is_int($ret = mysqli_stmt_execute($sth))) {
         return $ret;
     }
     return new MysqliResultSet($sth);
 }
开发者ID:jcs,项目名称:halfmoon,代码行数:31,代码来源:MysqliAdapter.php


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