Example #1
0
 public function __construct($db)
 {
     $d = getParametros($db);
     $this->error = "";
     try {
         $this->link = new PDO($d['type'] . ':host=' . $d['host'] . ';dbname=' . $d['name'] . ';charset=' . $d['charset'], $d['user'], $d['pass']);
         $this->link->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
         $this->link->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
         $this->link->setAttribute(PDO::MYSQL_ATTR_INIT_COMMAND, "SET NAMES 'utf8'");
     } catch (PDOException $e) {
         halting_error('error: ' . $e->getMessage());
         exit;
     }
 }
Example #2
0
        $s->bindValue(':id', $id);
        $s->execute();
        $valores = $s->fetch();
        $sql = 'SELECT * FROM paramnormas WHERE normaidfk=:id';
        $s = $pdo->prepare($sql);
        $s->bindValue(':id', $id);
        $s->execute();
        $nparams = array();
        foreach ($s->fetchAll(PDO::FETCH_ASSOC) as $value) {
            $nparams[] = $value['parametroidfk'];
        }
    } catch (PDOException $e) {
        $mensaje = 'No se pudo extraer informaciĆ³n del parametro. Favor de intentar nuevamente.' . $e;
        throwError($mensaje);
    }
    $parametros = getParametros();
    $pestanapag = 'Editar norma';
    $titulopagina = 'Editar una norma';
    $boton = 'Salvar Norma';
    include 'formacaptura.html.php';
    exit;
}
/**************************************************************************************************/
/* Salvar ediciĆ³n de una norma */
/**************************************************************************************************/
if (isset($_POST['accion']) and $_POST['accion'] == 'Salvar Norma') {
    include direction . functions . 'conectadb.inc.php';
    try {
        $pdo->beginTransaction();
        setParametros($_POST['id'], array_unique($_POST['parametro']));
        $pdo->commit();