Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function verMensajesUsuario($usuario){
- $conexion = $this->c->conectar();
- $sql = "SELECT mensajes.id, titulo,contenido,createAt, usuario
- FROM mensajes,usuarios
- WHERE mensajes.creador = usuarios.id AND usuarios.usuario = '$usuario';";
- $result = mysqli_query($conexion,$sql);
- if ($result->num_rows > 0) {
- return $result;
- }
- else{
- return false;
- }
- }
- <?php
- if (!isset($_SESSION['usuario'])) {
- header('location: ../login.php');
- }
- require_once 'conexion.php';
- require_once 'controllers/mensaje.php';
- //esto no hace falta pero para que quede modularizado
- $usuario =$_SESSION['usuario'];
- $mensaje_controllers = new Mensaje();
- $result = $mensaje_controllers->verMensajesUsuario($usuario);
- var_dump($result);
- $array_mensajes = $result->fetch_array();
- var_dump($array_mensajes);
- ?>
- 0 => string '6' (length=1)
- 'id' => string '6' (length=1)
- 1 => string 'titulo de jose ' (length=15)
- 'titulo' => string 'titulo de jose ' (length=15)
- 2 => string 'contenido de jose' (length=17)
- 'contenido' => string 'contenido de jose' (length=17)
- 3 => string '2019-04-20 17:47:40' (length=19)
- 'createAt' => string '2019-04-20 17:47:40' (length=19)
- 4 => string 'jose' (length=4)
- 'usuario' => string 'jose' (length=4)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement