mysqli binding troubles
Posted: Fri Jan 09, 2009 6:41 pm
Or to be more specific i get this error after trying to run the code bellow:
Fatal error: Call to a member function bind_param() on a non-object
I've googled for hours now without a solution, I'm about to pull my hair out over this. The general gist of what I've learned is that bind_param() returns False when the prepare statement is incorrect due to incorrect SQL, however I made the changes and still nothing. Anyone have an ounce of clue what I'm doing wrong here?
Fatal error: Call to a member function bind_param() on a non-object
Code: Select all
<?php
$firstName = $_POST["firstName"];
$lastName = $_POST["lastName"];
$email = $_POST["email"];
$zipcode = $_POST["zipcode"];
$country = $_POST["country"];
$comment = $_POST["comment"];
$conn = mysqli_connect("localhost", "root", "", "testdb");
$stmnt = $conn->prepare("INSERT INTO testtable (firstName, lastName, email, zipcode, country, comment)
VALUES(?, ?)");
$stmnt->bind_param("sssiss", $firstName, $lastName, $email, $zipcode, $country, $comment);
$stmnt->execute();
$stmnt->close();
$conn->close();
?>