Trying to query the database after form submission for "UID", then inserting it in proper table based on a certain value of the submitted form.
I am getting an error on this line
$stmt->bind_param("i", $uid);
Why? It says
Call to a member function bind_param() on bool
Anyone understand this?
$stmt = $conn->prepare("INSERT INTO users (type,username,password) VALUES (?,?,?)");
$stmt->bind_param("sss", $_POST['acct-reg'],$_POST['username-reg'],$_POST['pwd-reg']);
if ($stmt->execute()){
$sql= "SELECT uid FROM users WHERE username = ?";
$stmt = $conn->prepare($sql);
$stmt->bind_param("s", $_POST['username-reg']);
$stmt->execute();
$stmt->bind_result($uid);
while($stmt->fetch()) {
if ($_POST['acct-reg'] == 'a'){
$sql="INSERT into tasker (uid) VALUES (?)";
$stmt= $conn->prepare($sql);
$stmt->bind_param("i", $uid);
$stmt->execute();
$stmt->close();
}
}
};