Hello folks!
I have a table with several columns. For step one, when the registration happens, I want the user fill only just a few of them like ‘city, phone, email, password’.
I set most of my sql table columns to NULL (except the primary key) and the rest of them I gave default values but I’m keep having the following error message:
Fatal error : Uncaught Error: Call to undefined method PDOStatement::bind_param() in C:\xampp\htdocs\pr_mm\eps\newReg.php:23 Stack trace: #0 {main} thrown in C:\xampp\htdocs\pr_mm\eps\newReg.php on line 23
<?php
session_start();
include '../inc/init.php';
include 'inc/signupHeader.php';
$db = pdo_connect_mysql();
if (!isset($_POST['email'], $_POST['password'])) {
$status = "4"; // Minden mező
}
if (empty($_POST['email']) || empty($_POST['password'])) {
$status = "3"; // Minden mező
}
if ($stmt = $con->prepare('SELECT id, password FROM locations WHERE email = ?')) {
$stmt->bind_param('s', $_POST['email']);
$stmt->execute();
$stmt->store_result();
if ($stmt->num_rows > 0) {
$status = "2"; // Felhasználónév foglalt
} else {
if ($stmt = $db->prepare('INSERT INTO locations VALUES email = :email, password = :password, name = :name, l_phone = :l_phone, city = :city, address = :address')) {
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
$uniqid = uniqid();
$stmt->bind_param('ssssss', $_POST['email'], $password, $_POST['name'], $_POST['phone'], $_POST['city'], $_POST['address']);
$stmt->execute();
$status = "0"; // Siker
}
}
$stmt->close();
} else {
$status = "1"; // Hiba
}
$db->close();
?>