I have created this stored procedure:
CREATE PROCEDURE LogAdd(
IN log_title VARCHAR(128),
IN log_type ENUM('message','warning','error'),
IN log_info TEXT
)
DETERMINISTIC
MODIFIES SQL DATA
COMMENT 'Insert a new log entry'
BEGIN
INSERT INTO `tbl_logs` (
`title`,
`type`,
`info`
)
VALUES (
log_title,
log_type,
log_info
);
END
which works when executed with data directly added in the query. But when I bind parameters, the type
column, which is of ENUM
type, is not saved (is empty). I can see that the value is sent as a string:
$stmt = $pdo -> prepare("CALL LogAdd(?, ?, ?)");
$stmt -> bindParam(1, 'Message title');
$stmt -> bindParam(2, 'message');
$stmt -> bindParam(3, 'Message information');
$stmt -> execute();
Why isn't the ENUM
value saved?