I tried your code but getting this error:
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1414 OUT or INOUT argument 5 for routine jassimrahma_com.sp_add_new_ticket is not a variable or NEW pseudo-variable in BEFORE trigger' in /home/jassimuser/curesoftware.com/send_message.php:55 Stack trace: #0 /home/jassimuser/curesoftware.com/send_message.php(55): PDOStatement->execute() #1 {main} thrown in /home/jassimuser/curesoftware.com/send_message.php on line 55
here is the code:
$mysql_query = $mysql_connection->prepare("CALL sp_add_new_ticket(:param_ticket_name, :param_ticket_email, :param_ticket_subject, :param_ticket_message, :param_record_identity)");
$mysql_query->bindParam(':param_ticket_name', $ticket_name, PDO::PARAM_STR);
$mysql_query->bindParam(':param_ticket_email', $ticket_email, PDO::PARAM_STR);
$mysql_query->bindParam(':param_ticket_subject', $ticket_subject, PDO::PARAM_STR);
$mysql_query->bindParam(':param_ticket_message', $ticket_message, PDO::PARAM_STR);
$mysql_query->bindParam(':param_record_identity', $ticket_number, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT, 12);
$mysql_query->execute();
and here is the stored procedure:
CREATE DEFINER=`jassimdb`@`%.%` PROCEDURE `sp_add_new_ticket`(IN param_ticket_name varchar(255), IN param_ticket_email varchar(255), IN param_ticket_subject varchar(255), IN param_ticket_message text, INOUT param_record_identity int)
BEGIN
INSERT INTO support_tickets (ticket_guid, ticket_name, ticket_email, ticket_subject) VALUES (UUID(), param_ticket_name, param_ticket_email, param_ticket_subject);
SET param_record_identity = LAST_INSERT_ID();
INSERT INTO support_ticket_messages (ticket_id, support_ticket_message) VALUES (LAST_INSERT_ID(), param_ticket_message);
END