Jump to content

Problem with formatting output for MYSQL text


ifis

Recommended Posts

I have a simple query to a database that is supposed to post articles that people have submitted, the only problem is that there is a square after each period.  (i.e. "drag?�� The student responded, �Induced drag increases when flaps are extended.�� This is not correct.� Induced")

I have the field set to text.  What am I doing wrong and how can I fix it?  Thanks.

I think it is a double space problem.  I notice if I manually delete the two spaces between characters it gets rid of the square.  I am perplexed with why the squares show up, because if I look at the HTML of the posted page it does not include them.  I guess my question is; how could I trim the extra spaces?  I'm assuming I need some kind of replace function.  I'm not sure how I can find 2 consecutive blanks then delete one of them though.  Any ideas?

I cut and past the data in the table from a HTML file, I'm going to try if I input the data through a form if it will have the same problem.  My code is:

$sql = "SELECT * FROM blog WHERE LoginName='$row[loginName]'" or die("cannot connect to table");
$result=mysql_query($sql);

while($row = mysql_fetch_array($result)){
echo "<h1>$row[Title]</h1>";
echo "<p align='right'>Submitted: $row[Date]</p>";
echo "$row[Article]";

Thanks

Basically, I took a document I had in word, then cut and pasted it into Dreamweaver and cleaned it up.  I then took the html from Dreamweaver and put that into the field in my database.  I have that field set up as 'text' and 'utf8_general_ci'.  I don't know if that makes any difference, I usally use VARCHAR instead of TEXT in mysql databases.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.