data call [closed]

1

to see good morning, a doubt that I do not know because I get it. I have created a dashboard to host the news that I will use on a website but I have a problem, I copy the text in the textarea and I save it with spaces (as I need it) but my problem is when I call it on the web with php that when printed it puts it as a complete string and the spaces disappear and I do not know how to do it. Someone comes up with how to do it or what is the problem to solve

this is the render of painted on the web

    <div class="col-lg-12 col-md-12 col-sm-12">
        <div class="aboutus_area wow fadeInLeft">
            <?php
            if (isset($_POST['cero'])) {
                $noticia = Conexion::getNoticia0();
            }
            echo "<h2>" . $noticia["titulo"] . "</h2>";
            echo "<h3>" . $noticia["tema"] . "</h3>";
            echo "<p><span>" . $noticia["fuente"] . "</span></p>";
            echo "<p>" . $noticia["noticia"] . "</p>";
            echo "<p>" . $noticia["fecha"] . "</p>";
            ?>
            <p class='wow fadeInLeftBig animated' style='visibility: visible; animation-name: fadeInLeftBig;'>Siga visitando nuestra Web. <a href='index.php'>Inicio</a></p>
        </div>

and so I send it to the db

.
.
.
if (isset($_POST["campo_enlace"]) && $_POST["campo_enlace"] != "") {
    $enlace = filter_var($_POST["campo_enlace"], FILTER_SANITIZE_STRING);
}

if (isset($_POST["campo_fecha"]) && $_POST["campo_fecha"] != "") {
    $fecha = filter_var($_POST["campo_fecha"], FILTER_SANITIZE_STRING);
}

Conexion::setNewNoticia($tema, $titulo, $noticia, $fuente, $enlace, $fecha);

and the query I do to collect the data

public static function getNoticia($id) {
    $sql = "SELECT * FROM noticias WHERE id=$id";
    $resultado = self::consulta($sql);
    $noticia = array();

    if ($resultado) {
        $row = $resultado->fetch();
        while ($row != null) {
            $noticia[] = $row;
            $row = $resultado->fetch();
        }
    }
    return $noticia;
}
    
asked by mantamusica 06.03.2018 в 10:07
source

0 answers