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
https://forums.phpfreaks.com/topic/25277-adding-a-filename-to-a-database/
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.
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.

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.