ANTICHAT

ANTICHAT (https://forum.antichat.xyz/index.php)
-   Общие вопросы программирования (https://forum.antichat.xyz/forumdisplay.php?f=206)
-   -   Получить текст MySQL (https://forum.antichat.xyz/showthread.php?t=1389329)

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

Inserts HTML line breaks before all newlines in a string

www.php.net

Danilyuk_Alexander 29.05.2021 17:14

попробуй через тэг


Время: 06:51