meandme
meandme

Reputation: 2477

Remove white space from mysql data

When I get some data from my database and output it to my html table, I get some "?" at the end of the data.

Example

echo "<td>" . $row['data'] . "</td>";

gives

John Data��

So, how to remove the funny "��"?

Upvotes: 2

Views: 2008

Answers (2)

jbrtrnd
jbrtrnd

Reputation: 3833

trim() is for whitespace. The funny"��" is an encoding-problem. Try utf8_decode or utf8_encode function on $row['data'].

Upvotes: 3

konsolenfreddy
konsolenfreddy

Reputation: 9671

You can trim white spaces in PHP:

echo "<td>" . trim($row['data']) . "</td>";

But I think it's more of an encoding problem.

Upvotes: 2

Related Questions