Greetings my problem is this, I'm trying to make a query with PHP and jquery, where I send an empty data, just so that it returns a row of the MYSQL database but when I show the data in the HTML it gives me this
[object Object][object Object]
My code Js is as follows
$.getJSON("view_msj.php", function(mensajesd){
$("#mensajes").append("<div>" + mensajesd + "</div>");
});
And the PHP the next
<?php
try{
//$nom_msj = $_POST['dt_empys'];
$base = new PDO("mysql:host=localhost; dbname=quickchat", "root", "");
$base->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$base->exec("SET CHARACTER SET utf8");
// $resultado=$base->query("SELECT NOMBRE FROM sala WHERE NOMBRE='$nom_msj'");
$resultado=$base->query("SELECT MENSAJES FROM sala");
$rows = $resultado->fetchAll(\PDO::FETCH_OBJ);
echo (json_encode($rows));
}catch(Exception $e){
echo "Ha habido un error" . $e->GetMessage();
}
? >