0
I’m trying to execute an event command on mysql
, when developing the mysql Workbench, worked normally, but when using within the php’s mysqli_query the following error is displayed:
You have an error in your SQL syntax; check the manual that Corresponds to your Mysql server version for the right syntax to use near 'delimiter | CREATE EVENT evento1 ON SCHE' at line 1
follows below the code:
$sql = $conexao->query("delimiter |
CREATE EVENT evento1
ON SCHEDULE EVERY 1 DAY
STARTS TIMESTAMP '2016-08-17 15:00:00'
DO
BEGIN
INSERT INTO cliente_atendimento_cabecalho (atecabec_id, atecabec_total_atendimento, atecabec_prioridade, atecabec_agendamento, atecabec_data_abertura, atecabec_data_encerrado, atecabec_cod_tipo_atendimento, atecabec_cod_operador, atecabec_cod_cliente)
VALUES ( '$protocolo', '$total_atendimento', '$prioridade', '$agendamento', '$data_abertura_fechamento', '$encerrado', '$cod_tipo_atendimento', '$cod_operador', '$cod_cliente');
INSERT INTO cliente_atendimento_corpo (atecorp_descricao_solicitada, atecorp_data_abertura, atecorp_cod_departamento, atecorp_cod_operador, atecorp_cod_cabecalho)
VALUES ('$msg', '$data_abertura_fechamento', '$cod_departamento', '$cod_operador', '$protocolo');
END |
delimiter ;");
Dude, why are you creating an event in php? even more so with parameters for Insert? CREATE EVENT is a feature that is automatically executed by the database.
– Marco Souza
I need to get the user to register a type of monthly scheduled service, which every month automatically generates a customer service protocol
– Bruno Sartori
Then you will have to create some kind of PHP event or one that mounts your Insert and then run the query in the database. unless you have this data saved in the database, then simply change the settings to a select.
– Marco Souza
Why can’t it be done like this? before it was with a simple event query with only one Sert and it was working normally, after I modified it to work with the two that started giving error :(
– Bruno Sartori