Boa tarde!! estou tendo uma dificuldade de executar no scriptcase um teste simples de condição para um botão php no formulário seguinte;
SELECT COUNT(*) FROM mailing WHERE ramal=’[usr_login]’ and idcliente=99999999 and status_atend=1
se retornar 0 executa o insert
INSERT INTO callcenter.mailing (idcliente, razao, telefone1, tel1_status, telefone2, tel2_status, cpf_cnpj, id_campanha, ramal, status_atend, data_cadastro) VALUES (‘99999999’, ‘ATENDIMENTO PAUSADO’, ‘99999999999’, ‘1’, ‘99999999999’, ‘1’, ‘99999999999’, ‘999’, ‘[usr_login]’, ‘1’, CURRENT_TIMESTAMP)
se retornar 1 envia a mensagem que já existe a solicitação.
se alguém poder ajudar agradecido desde já!
segue o Código
$sql = “SELECT COUNT(*) FROM mailing WHERE ramal=’[usr_login]’ and idcliente=99999999 and status_atend=1”;
sc_lookup(rs, $sql);
if({rs[0][0]} != 0) {		
$sql = “INSERT INTO callcenter.mailing (idcliente, razao, telefone1, tel1_status, telefone2, tel2_status, cpf_cnpj, id_campanha, ramal, status_atend, data_cadastro) VALUES (‘99999999’, ‘ATENDIMENTO PAUSADO’, ‘99999999999’, ‘1’, ‘99999999999’, ‘1’, ‘99999999999’, ‘999’, ‘[usr_login]’, ‘1’, CURRENT_TIMESTAMP)”;
sc_exec_sql($sql);
} else {
sc_alert(“Já existe essa solicitação!”);
}
