Is there a way to drop non primary key column from specific table using prepared statement?
I tried this
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
// prepare and bind
$stmt = $conn->prepare("ALTER TABLE staff DROP COLUMN :col_name");
$stmt->bind_param(":col_name", $column_name);
// set parameters and execute
$column_name = "job_type1";
$stmt->execute();
But get this error:
Call to a member function bind_param() on boolean