-
Notifications
You must be signed in to change notification settings - Fork 0
/
obtenerser.php
43 lines (34 loc) · 1.12 KB
/
obtenerser.php
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
require 'metodos.php';
$conexion= conexion();
$table=$_POST["tab"];
$sql="select*from $table where matricula= '".htmlentities($_POST["alum_num"])."'";
mysqli_set_charset($conexion,"utf8");//formato de datos utf8
$result=mysqli_query($conexion,$sql);
$servicio= array();//se crea arreglo
if($table=='serviciosocial'){
while ($row= mysqli_fetch_array($result)) {
$rec=$row['rec03'];
$per=$row['periodo'];
$or=$row['organismo'];
$ct=$row['ct'];
}
$servicio[]= array('rec03'=>$rec,'perio'=>$per,'orga'=>$or,'ct'=>$ct);
$json_string=json_encode($servicio);
echo $json_string;
}
if($table=='estancia1'||$table=='estancia2'||$table=='estadia'){
while ($row= mysqli_fetch_array($result)) {
$rec=$row['rec03'];
$per=$row['periodo'];
$or=$row['organismo'];
$ev=$row['ev'];
$ct=$row['ct'];
$ca=$row['ca'];
}
$servicio[]= array('rec03'=>$rec,'perio'=>$per,'orga'=>$or,'ev'=>$ev,'ct'=>$ct,'ca'=>$ca);
$json_string=json_encode($servicio);
echo $json_string;
}
mysqli_close($conexion);
?>