DeFabregas DeFabregas - 1 year ago 78
MySQL Question

Why i don't get the complete records from my database?

Today i have been trying to get all the records from my database, but while doing it i have had some issues.

When i'm trying to get all the records from the database, i get some complete registers but some times, from a string of 3 characters i only get 1 character.

Here goes the photo from the database where i have the records and then the photo from the view of the webpage:

View of all the rehister in the MySQL Database:

enter image description here

View of the registers in the webpage

enter image description here

Here comes the PHP code:


$query = "SELECT * FROM Encrypt";

$do_query = mysqli_query($connection, $query);

if (mysqli_num_rows($do_query)) {
while ($row = mysqli_fetch_assoc($do_query)) {
<td>" . $row["id"] . "</td>
<td>" . $row["name"] . "</td>
<td>" . $row["content"] . "</td>
<td>" . $row["date"] . "</td>

Answer Source

The problem is that part of your ouput is seen as html by the browser. The opening of an html tag for example: <.

You need to encode the strings correctly so that there are no characters that might cause the browser to treat it as html:

For example:

"<td>" . htmlspecialchars($row["content"], ENT_QUOTES) . "</td>"
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download