PDA

Просмотр полной версии : Получить текст MySQL


Hideme Flow
29.05.2021, 13:24
Есть в базе данных `message` столбец `text`

https://forum.antichat.xyz/attachments/27753310/

я получаю `text`, пишу вот такой код

PHP:






$sql
=
"SELECT * FROM `messages` WHERE `id` = $id"
;
$result
=
$connect
-
>
query
(
$sql
)
;
$getmess
=
$result
-
>
fetch_row
(
)
;
$text
=
$getmess
[
3
]
;
echo
$text
;




и выводится

https://forum.antichat.xyz/attachments/27753310/

Как сделать чтобы выводилось

https://forum.antichat.xyz/attachments/27753310/

Hideme Flow
29.05.2021, 16:36
P.S. Сделал через тег

PHP:











и получается

https://forum.antichat.xyz/attachments/27753416/

попробовал сделать

PHP:






$text
=
preg_replace
(
'/\s+/'
,
' '
,
$text
)
;




и получается

https://forum.antichat.xyz/attachments/27753416/

Rei
29.05.2021, 16:58
PHP: nl2br - Manual (https://www.blast.hk/redirect/aHR0cHM6Ly93d3cucGhwLm5ldC9tYW51YWwvZW4vZnVuY3Rpb2 4ubmwyYnIucGhw)

Inserts HTML line breaks before all newlines in a string

www.php.net

Danilyuk_Alexander
29.05.2021, 17:14
попробуй через тэг