PHP - Me salta el error net::ERR_CONNECTION_RESET

 
Vista:
sin imagen de perfil
Val: 6
Ha aumentado su posición en 23 puestos en PHP (en relación al último mes)
Gráfica de PHP

Me salta el error net::ERR_CONNECTION_RESET

Publicado por borja (5 intervenciones) el 06/03/2019 13:43:47
tengo una web con una lista desplegable que muestra una serie de códigos y según el código que seleccione se completan las cajas de texto, mi problema viene cuando selecciono uno de los códigos que en la cajas de texto me aparece "undefined" y en la consola del navegador me aparece el siguiente error net::ERR_CONNECTION_RESET, he estado buscando por Google pero no he dado con la solución.( Mi web esta alojada en 000webhost).

Pagina donde se selecciona el código

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?php
//* configuracion database.
include("conexion.php");
 
 
 
function filtrado($datos){
    $datos = trim($datos); // Elimina espacios antes y después de los datos
    $datos = stripslashes($datos); // Elimina backslashes \
    $datos = htmlspecialchars($datos); // Traduce caracteres especiales en entidades HTML
    return $datos;
}
 
$consulta = "SELECT * FROM RUCQ_Principal";
$resultado = mysqli_query($conexion, $consulta);
 
.
 
 
?>
 
 
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 
<head>
    <link href="CSS\style_Modificar.css" rel="stylesheet" type="text/css" />
   <link href="CSS\Modificar_Datos_Principales.css" rel="stylesheet" type="text/css" />
 
 
    <title>Modificar Datos Principales</title>
</head>
 
<body>
 
 
  <h1>MODIFICAR DATOS PRINCIPALES</h1>
 
 
 
 
<div class="Contenido">
 
<form>
 
 
 
 
 
<?php
  include("conexion.php");
 
 
 
 
  $query = 'SELECT * FROM RUCQ_Principal';
 
  $result = $conexion->query($query);
 
?>
  <p>Código Interno</p>
  <select id="producto" onchange="ShowSelected();" name="producto">
 
       <option value="0" > Seleccione:</option>
    <?php
    while ( $row = $result->fetch_array() )
    {
        ?>
 
 
 
       <option value="<?php echo $row['Cod_Interno']; ?>" > <?php echo $row['Cod_Interno']; ?></option>
 
 
 
        <?php
 
 
    }
 
    ?>
 
  </select>
<?php
 
?> <br>
 
<script type="text/javascript">
 
function ShowSelected()
{
 
var cod = document.getElementById("producto").value;
 
 
if(cod == '0'){
 
alert('Elige una opción');
return false;
 
}else{
 
if (window.XMLHttpRequest) {
clean = new XMLHttpRequest();
  }else{
clean = new ActiveXObject("Microsoft.XMLHTTP");
  }
 
  clean.onreadystatechange = function(){
 
  if (clean.readyState  == 4 && clean.status == 200) {
 
var respuesta = clean.responseText;
 
var jsonjs = JSON.parse(respuesta);
 
 
 
console.log(jsonjs[0].cOficial);
console.log(jsonjs[0].gHospital);
console.log(jsonjs[0].tLocal);
console.log(jsonjs[0].tQS);
console.log(jsonjs[0].cNacional);
console.log(jsonjs[0].coAutonomico);
console.log(jsonjs[0].hSiglas);
console.log(jsonjs[0].fAlta);
console.log(jsonjs[0].fBaja);
console.log(jsonjs[0].tBaja);
console.log(jsonjs[0].cEpisodio);
 
 
 
 
document.getElementById('Centrooficial').value = jsonjs[0].cOficial;
 
document.getElementById('GrupoHospital').value = jsonjs[0].gHospital;
 
document.getElementById('TipoLocal').value = jsonjs[0].tLocal;
 
document.getElementById('TerritorioQS').value = jsonjs[0].tQS;
 
document.getElementById('CodigoNacional').value = jsonjs[0].cNacional;
 
document.getElementById('CodigoOficialAutonomico').value = jsonjs[0].coAutonomico;
 
document.getElementById('Siglas').value = jsonjs[0].hSiglas;
 
document.getElementById('FechaAlta').value = jsonjs[0].fAlta;
 
document.getElementById('FechaBaja').value = jsonjs[0].fBaja;
 
document.getElementById('TipoBaja').value = jsonjs[0].tBaja;
 
document.getElementById('CodigoEpisodio').value = jsonjs[0].cEpisodio;
 
 
 
}
 
}
 
clean.open('GET','Consulta_Datos_Principales.php?cod='+cod,true);
 
clean.send();
 
}
}
 
</script>
 
  Nombre Centro Oficial
  <input type="textbox" name="Centrooficial" id="Centrooficial"><br>
 
  Grupo Hospital
  <input type="textbox" name="GrupoHospital" id="GrupoHospital"><br>
 
  Tipo Local
  <input type="textbox" name="TipoLocal" id="TipoLocal"><br>
 
  Territorio QS
  <input type="textbox" name="TerritorioQS" id="TerritorioQS"><br>
 
  Código Nacional
  <input type="textbox" name="CodigoNacional" id="CodigoNacional"><br>
 
  Código Ofical Autonómico
  <input type="textbox" name="CodigoOficialAutonomico" id="CodigoOficialAutonomico"><br>
 
  Siglas
  <input type="textbox" name="Siglas" id="Siglas"><br>
 
  Fecha Alta
  <input type="textbox" name="FechaAlta" id="FechaAlta"><br>
 
  Fecha Baja
  <input type="textbox" name="FechaBaja" id="FechaBaja"><br>
 
  Tipo Baja
  <input type="textbox" name="TipoBaja" id="TipoBaja"><br>
 
  Código Episodio
  <input type="textbox" name="CodigoEpisodio" id="CodigoEpisodio" ><br>
 
  <br>
 
  <input type="submit" name="accion" value="Grabar" />
 
</form>
 
 
</div>
 
</body>
 
 
 
</html>




Pagina donde se realiza la consulta para devolver los valores


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
 
 
$codigo = $_GET['cod'];
 
 
 
include("conexion.php");
 
 
 
 
 
$query = "SELECT * FROM RUCQ_Principal WHERE Cod_Interno = '$codigo'  ";
 
 
 
$resultado = mysqli_query($conexion, $query)or die ('Fallo al realizar la consulta');
 
 
 
 
$datos = array(['Centrooficial' => $row[0],
				'GrupoHospital' => $row[1],
				'TipoLocal' => $row[2],
				'TerritorioQS' => $row[3],
				'CodigoNacional' => $row[4],
				'CodigoOficialAutonomico' => $row[5],
				'Siglas' => $row[6],
				'FechaAlta' => $row[7],
				'FechaBaja' => $row[8],
				'TipoBaja' => $row[9],
				'CodigoEpisodio' => $row[10]
 
]);
 
 
 
echo json_encode($datos);
 
 
 
?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder