Hello! I am new to PHP. I have a composite keys (FirstName, MiddleName, LastName, LastSchoolAttended) How can I limit it to 1 and never repeat it. I also think I have a problem with the syntax in binding parameter. I am having an error with $stmt = $conn->prepare ($SELECT) at the moment. This is my code:
$SELECT = "SELECT FirstName, MiddleName, LastName, LastSchoolAttended From information Where FirstName = ? And MiddleName = ? And LastName = ? And LastSchoolAttended = ? Limit 1";
$INSERT = "INSERT Into information (FirstName, MiddleName, LastName, Age, HomeAddress, ContactNumber, LastSchoolAttended) values (?,?,?,?,?,?,?)"
$stmt = $conn->prepare($SELECT);
$stmt -> bind_param("ssss", $FirstName,$MiddleName,$LastName,$LastSchoolAttended);
$stmt -> execute();
$stmt -> bind_result($FirstName,$MiddleName,$LastName,$LastSchoolAttended);
$stmt -> store_result();
$rnum = $stmt -> num_rows;
if ($rnum == 0 ) {
$stmt->close();
$stmt = $conn -> prepare($INSERT);
$stmt -> bind_param("sssisis", $FirstName,$MiddleName,$LastName,$Age,$HomeAddress,$ContactNumber,$LastSchoolAttended);
$stmt -> execute();
}