Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/06/2014, 19:35
Avatar de Shikari
Shikari
 
Fecha de Ingreso: mayo-2012
Mensajes: 72
Antigüedad: 12 años
Puntos: 0
Mostrar registro de la última inserción

¿Qué tal comunidad? Pues, vengo presentando otra de dudas, espero y me puedan ayudar.

Tengo esta función:
Código PHP:
<?php
$RespuestaOK  
false;
$MensajeError 'No se puede ejecutar la aplicación';
$ContenidoOK  '';

include(
'../dbConn.inc.php');
include(
'../includes/functions.inc.php');
if (
$errorDbConexion == false) {
    if (isset(
$_POST) && !empty($_POST)) {
        switch (
$_POST['accion']) {
            case 
'addNew':
                
$query sprintf("INSERT INTO news
                                  SET title='%s', content='%s', author='%s'"
,
                                  
$_POST['newsTitle'],
                                  
$_POST['newsContent'],
                                  
$_POST['newsAuthor']);

                
$ResultadoQuery $mysqli -> query($query);

                if (
$ResultadoQuery == true) {
                    
$RespuestaOK  true;
                    
$MensajeError 'El registro fue exitoso';
                    
$ContenidoOK '
                        <tr>
                            <td>'
.$_POST['newsTitle'].'</td>
                            <td>'
.$_POST['newsAuthor'].'</td>
                            <td>'
.$_POST['Info'].'</td>
                            <td>'
.$_POST['Info'].'</td>
                            <td>'
.$_POST['Info'].'</td>
                        </tr>
                    '
;
                } else {
                    
$MensajeError 'No se puede almacenar el registro';
                }

                break;
            
            default:
                
$MensajeError 'Esta acción no se encuentra disponible';
                break;
        }
    } else {
        
$MensajeError 'No se puede ejecutar la aplicación';
    }
} else {
    
$MensajeError 'No se puede establecer conexión a la Base de Datos';
}

$SalidaJson = array(
    
'respuesta' => $RespuestaOK,
    
'mensaje'   => $MensajeError,
    
'contenido' => $ContenidoOK
);

echo 
json_encode($SalidaJson);
Y en esta variable:
Código PHP:
$ContenidoOK '
    <tr>
        <td>'
.$_POST['newsTitle'].'</td>
        <td>'
.$_POST['newsAuthor'].'</td>
        <td>'
.$_POST['Info'].'</td>
        <td>'
.$_POST['Info'].'</td>
        <td>'
.$_POST['Info'].'</td>
    </tr>
'

Quiero meter en los td, la información del último registro que se ha hecho.

Espero y me puedan ayudar, saludos.