Hi,
Thanks for your pointers, the links you sent me, they were very helpful. I have been trying out stuff changing my database code, using prepared statements as you’ve advised, but I get this error message, when I run the code.
After filling a web-form on clicking the submit button, I get this
Fatal error: Call to a member function bind_param() on a non-object in /homepages/18/d440109193/htdocs/welcome.php on line 22
I tried to fix the problem, but I keep getting the same error message, any suggestions to fix this error.
SEE BELOW THE CURRENT CODE.
<?phpsession_start();spl_autoload_extensions(".php");$servername = "localhost";$username = "username";$password = "password";$dbname = "myDB";// CREATE CONNECTION - LINK_IDENTIFIER, MYSQL CONNECTION$conn = new mysqli("xxxxxxxx", "xxxxxxxx", "xxxxxxxx", "xxxxxxxx"); // CHECK CONNECTIONif ($mysqli->connect_error) { die('Connect Error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error);}//PREPARE AND BIND$stmt = $conn->prepare("INSERT INTO Users (username, firstname, lastname, email, password, confirmpassword) VALUES(?, ?, ?, ?, ?, ?)");$stmt->bind_param("ssssss", $username, $firstname, $lastname, $email, $password, $confirmpassword);//SET PARAMETERS AND EXECUTE$username = "";$firstname = "";$lastname = "";$email = "";$password = "";$confirmpassword = "";$stmt->execute();echo "New records created successfully";$stmt->close();$conn->close();?>
any suggestions to fix this,
Thanks!