
PHP - Datetime - Separar en 2 columnas Fecha y Hora, dentro de una consulta.
Publicado por Miguel Ángel (3 intervenciones) el 02/09/2015 22:16:05
Buenas tardes:
Estoy realizando una consulta dentro de una tabla, quiero separar en 2 columnas la fecha y hora de un atributo Datetime (fecha_audiencia):
y al visualizarlo en localhost me genera el siguiente error:
Notice: Undefined index: fecha_audiencia in
Haciendo la consulta en MySql si me muestra las columnas, pero en localhost no, espero me puedan ayudar. De antemano muchas gracias.
Estoy realizando una consulta dentro de una tabla, quiero separar en 2 columnas la fecha y hora de un atributo Datetime (fecha_audiencia):
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
<?php
include("conexion.php");
$link=Conectarse();
$listado= mysql_query("SELECT c.no_causa, a.audiencia, c.delito, DATE_FORMAT(a.fecha_audiencia,'%d/%m/%Y')AS Fecha,TIME_FORMAT(a.fecha_audiencia,'%h:%i %p') AS Hora
FROM causa c
JOIN audiencia a ON (c.id_causa = a.id_causa)");
?>
<script type="text/javascript" language="javascript" src="js/jslistadopaises.js"></script>
<table cellpadding="0" cellspacing="0" border="0" class="display" id="tabla_lista_paises">
<thead>
<tr>
<th>No. de Causa</th><!--Estado-->
<th>Audiencia</th>
<th>Delito</th>
<th>Fecha</th>
<th>Hora</th>
</tr>
</thead>
<tfoot>
<tr>
<th></th>
<th></th>
</tr>
</tfoot>
<tbody>
<?php
while($reg= mysql_fetch_array($listado))
{
echo '<tr>';
echo '<td align="center" >'.$reg['no_causa'].'</td>';
echo '<td align="center" >'.$reg['audiencia'].'</td>';
echo '<td align="center" >'.$reg['delito'].'</td>';
echo '<td align="center" >'.$reg['fecha_audiencia'].'</td>';
echo '<td align="center" >'.$reg['fecha_audiencia'].'</td>';
echo '</tr>';
}
?>
<tbody>
</table>
y al visualizarlo en localhost me genera el siguiente error:
Notice: Undefined index: fecha_audiencia in
Haciendo la consulta en MySql si me muestra las columnas, pero en localhost no, espero me puedan ayudar. De antemano muchas gracias.
Valora esta pregunta


0