5
I need to send a date by $_GET
but I am not succeeding, what is the method to make this passage ?
The shipment is like this:
ajax/deletaPessoaVinculo.php?dt=2016-01-29&p=PV&a=1&pb=3&c=SUPRV
And the array
is getting like this:
Array ( [:COD_TIPOX_VINCU] => SUPRV [:COD_IDENT_PESSO] => 3 [:DAT_INICI_VINCU] => 116122144423521 [:igj] => ibhr )
I’m building my HTML like this:
. '<td><a class="ajax-link" href="ajax/deletaPessoaVinculo.php?dt='. dataDeDMAParaAMD($vinculo->DAT_INICI_VINCU) .'&p=PV&a=1&pb=' . $w_COD_IDENT_PESSO . '&c=' . $vinculo->COD_TIPOX_VINCU . '"><i class="fa fa-times"></i></a></td>'
And to receive :
$w_DAT_INICI_VINCU = ( isset($_GET['dt']) ? $_GET['dt'] : "" );
My function dataDeDMAParaAMD simply puts the date in the way that the server can save, described below:
<?php
if (!function_exists('eglise_dataDeDMAParaAMD')) {
function eglise_dataDeDMAParaAMD($p_data) {
return (strlen($p_data) === 10 ? substr($p_data, 6, 4) . '-' . substr($p_data, 3, 2) . '-' . substr($p_data, 0, 2) : (strlen($p_data) === 0 ? null : $p_data));
}
}
I set the array at this time:
function deletaUnico($w_pagina) {
global $suc, $w_COD_TIPOX_VINCU, $conexao;
$campos = array();
$campos[':COD_TIPOX_VINCU'] = $_GET['c'];
$campos[':COD_IDENT_PESSO'] = $_GET['pb'];
$campos[':DAT_INICI_VINCU']= $_GET['dt'];
$campos[':igj'] = $suc->getCOD_IDENT();
error_log($_GET['dt']); //Aqui ja aparece o numero todo maluco
$sqlDIV = "DELETE FROM"
. " tbl_IGREJA_VINCULOS"
. " WHERE"
. " and COD_TIPOX_VINCU = :COD_TIPOX_VINCU"
. " and COD_IDENT_PESSO = :COD_IDENT_PESSO"
. " and DAT_INICI_VINCU = :DAT_INICI_VINCU";
error_log(print_r($campos));
try {
$conexao->getConnection()->beginTransaction();
$conexao->atualiza($sqlDIV, $campos);
$conexao->getConnection()->commit();
} catch (Exception $e) {
$conexao->getConnection()->rollback();
die('ERRO AO ATUALIZAR BANCO DE DADOS');
error_log('vinculoUpd.php: ' . $e->getMessage());
}
Please avoid long discussions in the comments; your talk was moved to the chat
– Maniero