Prepared statement in php

<?php

// Create connection
$conn = new mysqli('localhost', 'root', '', 'test');

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// prepare and bind
$stmt = $conn->prepare("INSERT INTO test (name, email) VALUES (?, ?)");
$stmt->bind_param("ss", $name, $email);

// set parameters and execute
$name = "Saurabh";
$email = "info@www.coding4developers.com";
$stmt->execute();

$name = "Gauravg";
$email = "query@www.coding4developers.com";
$stmt->execute(); ...  Read More

Share This: