Jump to content

Recommended Posts

I have a database table that current has about a hundred entries. There are twenty or so fields in the table. I have one particular record that I just cannot figure out. One of the fields is a longtext field where a text narrative is placed.  With this problem record, when I go in to edit it later, the narrative field is grayed out and won't let me edit it. I checked it today, and the db actually dropped the contents of that field so that it was empty! I was then able to re-past the narrative, but sure enough, it was uneditable when I went back in (I'm sure it will disappear eventually).

 

So I'm at a loss. No other record is doing this. I thought that I maybe had a hidden character that was causing this. So I retyped the entire thing in a plain text editor. Didn't help. Then I tried just deleting the entire record and re-entering it (I'm coding all these pages with php, obviously--MySQL for the db). Same problem. But I've since entered other records and haven't had this problem. So I thought that maybe the colons in the narrative were the problem--don't know why they would be, but you never know. Nope, that wasn't it.

 

Anyone have an idea of what I should try next? There's something about this particular record and it's narrative that my db just does not like, and I can't figure out what that is.

Maybe this would sound obvious for most but, have you tried to type the text directly in phpMyAdmin? I'm asking because some text editors add special hidden characters. Please disregard this comment if it's too stupid. Thanks.

 

Not too stupid. I'll give that a shot. A pasted directly into phpMyAdmin, but I didn't try typing directly into it.

I am curious as to what is doing: "the narrative field is grayed out and won't let me edit it"? phpMyAdmin? What are you using to edit the field basically?

 

Sorry. It's the online form I use for entering new records. HTML/PHP form that inputs into the MySQL database.

I would guess there are some HTML characters in the textarea then...make sure you run the text through htmlspecialchars() before putting it inside the textarea tags:

 

<?php
  $mytext; //The variable containing the text from the DB
  echo '<textarea name="foobar">'.htmlspecialchars($mytext).'</textarea>';
?>

 

If you show some of the code, I may be able to help further on it

I would guess there are some HTML characters in the textarea then...make sure you run the text through htmlspecialchars() before putting it inside the textarea tags:

 

OK, so I tried that, and it didn't work. Then as I was getting ready to copy the code to show you, I noticed something odd with it (how it escaped me until now I'll never know). Tried a fix, and it's working now! I'm not sure why it picked now (after more than a year) and only this record to show me it didn't like what I did, but I think it's fixed now. Thanks!

 

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.