Call to a member function bind_param() on boolean

The error is because the prepare() call failed and you don’t have any error handling to tell you if and why a database statement failed.

This code is attempting to do the same thing as in one of your previous threads - Trying to check if block_lot_no is already existing using prepared statements I recommend that you reread that thread and do the things mentioned in the replies, concerning just attempting to INSERT the data and detecting in the error handling if a duplicate index error occurred. The suggested usage of exceptions for database statement errors will also tell you why the prepare call is failing in this code.