Prepared > PHP

본문 바로가기
사이트 내 전체검색

PHP

MySQLi Extension Prepared

페이지 정보

profile_image
작성자 관리자
댓글 0건 조회 1,573회 작성일 22-04-26 17:57

본문

public mysqli_stmt::bind_param(string $types, mixed &$var, mixed &...$vars): bool 


types

A string that contains one or more characters which specify the types for the corresponding bind variables:

Type specification chars
CharacterDescription
icorresponding variable has type integer
dcorresponding variable has type double
scorresponding variable has type string
bcorresponding variable is a blob and will be sent in packets


// prepare and bind

$stmt = $mysqli->prepare("INSERT INTO MyGuests (firstname, lastname, email) VALUES (?, ?, ?)");

$stmt->bind_param("sss", $firstname, $lastname, $email);


// set parameters and execute

$firstname = "John";

$lastname = "Doe";

$email = "john@example.com";

$stmt->execute();


$firstname = "Mary";

$lastname = "Moe";

$email = "mary@example.com";

$stmt->execute();


$firstname = "Julie";

$lastname = "Dooley";

$email = "julie@example.com";

$stmt->execute();


echo "New records created successfully";


$stmt->close();

댓글목록

등록된 댓글이 없습니다.

회원로그인

회원가입

Copyright © neion.co.kr All rights reserved.