Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    137
    Thanks
    1
    Thanked 0 Times in 0 Posts

    question about textarea

    hi

    i am planning to use a feedback form on the website for users to send their feedback. apart from a few textfields i want to use a textarea where the user will enter their feedback. since the feedback could be long at times, in the database i will define this field as long datatype

    my question is

    1.
    i will define the field in the table as ex: comments longtext, is this correct

    2.
    also since the comments can be very long are there any potential issues in the data being inserted into mysql database. will the entire data be captured or only a portion of it

    3.
    will all the comments be captured in the excel sheet when exporting the table as an excel sheet.

    please advice.

    waiting for reply.

  • #2
    Regular Coder
    Join Date
    Nov 2006
    Posts
    246
    Thanks
    13
    Thanked 26 Times in 24 Posts
    1.
    That would be correct.
    Code:
    CREATE TABLE table_name (comments longtext)
    2.
    longtext will store up to 4 GBs or 4,294,967,295 characters. Unless someone plans on writing feedback for your site that exceeds the length of the Bible, you're safe. That said, longtext maybe overdoing it. There's 4 "text" column types:

    tinytext = max 255 characters
    text = max 65,535 characters
    mediumtext = max 16,777,215 characters
    longtext = max 4,294,967,295 characters

    Regardless of which you use, you should probably have another way of maximizing the length of the string; done through PHP. Ex:
    PHP Code:
    if(strlen($_POST[comment]) > 50000){
        exit(
    "Comment is too long!");

    3.
    I don't anything about excel sheets. Someone else will have to help you here. Sorry.

  • #3
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    How are you going to export it to an excel sheet? I'm pretty sure you'll just pass it a query and the results are returned and made into a .csv file or something.
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #4
    Senior Coder
    Join Date
    Mar 2003
    Location
    Atlanta
    Posts
    1,037
    Thanks
    14
    Thanked 30 Times in 28 Posts
    You also might want to mention the type and version of the database you're using.
    Most of my questions/posts are fairly straightforward and simple. I post long verbose messages in an attempt to be thorough.

  • #5
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    Quote Originally Posted by StupidRalph View Post
    How are you going to export it to an excel sheet? I'm pretty sure you'll just pass it a query and the results are returned and made into a .csv file or something.
    You can export database data into an Excel spreadsheet through phpMyAdmin.

  • #6
    Super Moderator JohnDubya's Avatar
    Join Date
    Nov 2006
    Location
    Missouri
    Posts
    634
    Thanks
    12
    Thanked 18 Times in 18 Posts
    Quote Originally Posted by sudhakararaog View Post
    2.
    also since the comments can be very long are there any potential issues in the data being inserted into mysql database. will the entire data be captured or only a portion of it

    3.
    will all the comments be captured in the excel sheet when exporting the table as an excel sheet.

    please advice.

    waiting for reply.
    When I want to allow my users to input a large amount of text into my database, I always use TEXT. It seems to work great for most normal purposes (besides whole books and such). As for the Excel sheet, if you export from phpMyAdmin or other similar program, the input from the TEXT field should export just fine.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •