S
S
Sergey Konev2020-05-14 12:18:51
PHP
Sergey Konev, 2020-05-14 12:18:51

How to execute given htmlspecialchars_decode function?

How to execute given function in my code:htmlspecialchars_decode

<?php
require_once 'connection.php'; 
 
$link = mysqli_connect($host, $user, $password, $database) 
    or die("Ошибка " . mysqli_error($link)); 
     
$query ="SELECT `id`, `company`, `status_1`, `data_1`, `data_2`, `file`, `summ`, `status_2`, `note`  FROM appcation WHERE 1"; 

$result = mysqli_query($link, $query) or die("Ошибка " . mysqli_error($link)); 
if($result)
{
    $rows = mysqli_num_rows ($result); // количество полученных строк
    for ($i = 0 ; $i < $rows ; ++$i)
 
    {
        $row = mysqli_fetch_row ($result);
        echo "<tr>";
            for ($j = 0 ; $j < 9 ; ++$j) echo "<td>$row[$j]</td>";
        echo "</tr>";
    }
    echo "</table>";
    mysqli_free_result($result);
}
mysqli_close($link);
?>


At the moment, I have links with HTML tags in the database table and they are displayed with the symbols shown in the screenshot 5ebd0e009f8be943409418.png and the link becomes not active but in plain text.
I read that this htmlspecialchars_decode function converts these characters into HTML tags and the link becomes habitually active.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ilya, 2020-05-14
@agressor221

In a loop:

echo "<tr>";
for ($j = 0 ; $j < count($row) ; ++$j) {
    echo "<td>";
    echo htmlspecialchars_decode($row[$j]);
    echo "</td>";
}
echo "</tr>";

F
FanatPHP, 2020-05-14
@FanatPHP

This function should never be used.
If you need it, you are doing something wrong.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question