Jump to content

Adding a filename to a database?


cturner

Recommended Posts

Can someone please tell me what data type I should use for adding a filename to a database?

And why does my description database field display question marks for apostrophes? The data type for the description field is longtext.

This is the description field: [i]This (and the Magic-Iron on label) are THE basic items of your back to school pack. Try to do without them and you risk loosing your brand new kit, or worse still your child coming home with someone elses mankey old shoes. [b]Don?t[/b] say you [b]haven?t[/b] been warned![/i]
Link to comment
Share on other sites

You would need to escape special characters like apostrophes. If you are using PHP to get the data into the table, then have a look at [url=http://uk.php.net/addslashes]addslashes()[/url]. I normally use a VARCHAR datatype for filenames - as long as you do mean just the filename, and not the file itself.
Link to comment
Share on other sites

No need to double-post about the filename / data type question; you've been warned.

As for the description field, sounds like you have special characters, usually from a cut-and-paste operation from a rich-text editor.  You need to strip all of these, convert them somehow, or encode them.
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.