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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.