<?php require_once '../../modelo/mod_connex.php'; $conexion = new Connex(); $pgconn = $conexion->conectar(); require '../../modelo/mod_farmacia.php'; $farmacia = new farmacia(); $consulta = $farmacia->listar_estado($pgconn); for ($i = 0; $i < pg_num_rows($consulta); $i++) { $row = pg_fetch_array($consulta, $i, PGSQL_ASSOC); $est_cod[$i] = $row["est_cod"]; $est_nombre[$i] = $row["est_nombre"]; }
require '../../modelo/mod_connex.php'; $conexion = new Connex(); $pgconn = $conexion->conectar(); $array = $_POST['param1']; $num = ''; foreach ($array as $key) { if ($key['name'] == "estado") { $est_cod = $key['value']; } if ($key['name'] == "nombre") { $far_nombre = $key['value']; } if ($key['name'] == "direccion") { $far_direccion = $key['value']; } if ($key['name'] == "responsable") { $far_responsable = $key['value']; } if ($key['name'] == "numero") { $num .= $key['value'] . ' '; } if ($key['name'] == "tipo_linea") { $tipo_linea = $key['value']; } } require '../../modelo/mod_farmacia.php'; $farmacia = new farmacia(); $inserto = $farmacia->agregar($est_cod, $far_nombre, $far_direccion, json_encode(array($tipo_linea => $num)), $far_responsable, $pgconn); if ($inserto) { echo "\r\n<body>\r\n\t<meta http-equiv='content-type' content='text/html; charset=utf-8' />\r\n\t<link rel='stylesheet' type='text/css' href='../../sweetalert/lib/sweet-alert.css'>\r\n\t<script type='text/javascript' src='../../sweetalert/lib/sweet-alert.min.js' ></script>\r\n\t<script type='text/javascript'>swal({title:'Registro Exitoso!', type: 'success',confirmButtonText:'Cerrar'},function(){window.location.href='../../vista/farmacia/agregar_farmacia.php'});\r\n\t</script>\r\n</body>"; }
<?php require_once '../../modelo/mod_connex.php'; $conexion = new Connex(); $pgconn = $conexion->conectar(); require_once '../../modelo/mod_farmacia.php'; $farmacia = new farmacia(); $resp = $farmacia->consultar_farmacia($pgconn); for ($i = 0; $i < pg_num_rows($resp); $i++) { $row = pg_fetch_array($resp, $i, PGSQL_ASSOC); $far_cod[$i] = $row["far_cod"]; $far_nombre[$i] = $row["far_nombre"]; }