I am learning php and trying to do the following work:
<?php
require_once("db_connect.php");
$dname = $_POST["dname"];
$daddress = $_POST["daddress"];
$stmt = $mysqli->prepare("INSERT INTO test (dname, daddress) VALUES (?, ?)");
$stmt->bind_param("s", $dname, $daddress);
$stmt->execute();
$stmt->close();
$mysqli->close();
?>
It works with only one bind_param, but not 2. If $ daddress has been removed from the code, it sends messages. The form contains 26 posts in the database. I am doing this with 2 at the moment to keep it minimal.
When submitting a form, the following error appears.
Warning: mysqli_stmt :: bind_param () [mysqli-stmt.bind-param]: The number of elements in the type definition line does not match the number of binding variables in / home / mymotorsportco / public _html / entry / actions / entry. php on line 15
source
share