S
S
SergeyQA3172020-01-26 14:02:57
PHP
SergeyQA317, 2020-01-26 14:02:57

Problem with output from DB(php,pdo)?

Hi guys!
Actually I have a database with a table content whose type is text.
In this content table there is data like a php code (<?php echo "123"; ?>)
if you remove the tags or insert something like plain text - "lalalala", then everything is displayed, otherwise - a white screen.
PHP file that outputs entry:
...
$sth = $dbh->prepare("SELECT content FROM `pages`");
$sth->execute();
$array = $sth->fetchAll();
foreach ($array as $result_row) {
echo $result_row["content"];
}
...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arman, 2020-01-26
@SergeyQA317

https://www.php.net/manual/ru/function.htmlspecial...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question