#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    15
    Rep Power
    0
    I have a website that spools out data to a form, but any data in it that has a space is cut off after the first space.

    I have it currently set to VARCHAR.

    What type will allow spaces and will spool the data properly?
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Location
    Redding, CA
    Posts
    15
    Rep Power
    0
    If you are using PHP try wrapping the variable that you use to "spool" out the data in a single quote ( <input type=text value='$var'> ). That fixed it for me.

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by Rolemaster:
    I have a website that spools out data to a form, but any data in it that has a space is cut off after the first space.


    I have it currently set to VARCHAR.


    What type will allow spaces and will spool the data properly?
    [/quote]

  4. #3
  5. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    15
    Rep Power
    0
    Inputting is also a problem. Any input data that has spaces in it, is cut off after the first space.

    So its not a MySQL mis-config? I was sure hoping it was so that I would not have to re-code the webpage...
  6. #4
  7. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    15
    Rep Power
    0
    How would that '$var' attribute work? Do I have to pre set the variables?
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Location
    Redding, CA
    Posts
    15
    Rep Power
    0
    To answer both of your questions...

    I am assuming that you are doing an INSERT to dump the form data into the db. When you hit submit the form data gets passed to the page that actually performs the INSERT as a bunch of variables. Lets call one of the fields in the form "text1"...
    <input type=text name=text1>
    When submitted to the next page (or the same page depending on how you have it set up) to be INSERTed you have a variable named $text1 with the value of whatever the user typed in. So you do your INSERT in whatever script language you are using...

    INSERT INTO table (column1) VALUES ($text1);

    Now this will chop off when it encounters a space. If you change it to this...

    INSERT INTO table (column1) VALUES ('$text1');

    you will retain the spaces.

    It works the same when you are getting the info from the db to put on the form (probably to edit a record or something). When the page starts to load you grab all the records you will be needing from the db with some type of SELECT and preset the array values into variables. Then you do this in your form somewhere...
    <input type=text name=text1 value='$text1'>

    This will retain the spaces that were inserted into the db.

    Aaron


    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by Rolemaster:
    How would that '$var' attribute work? Do I have to pre set the variables?[/quote]

  10. #6
  11. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    15
    Rep Power
    0
    Thanks for that last post, That gave me a really good idea that fixed the whole issue. You guys rock.

    Thanks again.

Similar Threads

  1. problem in updating data type for datetime
    By poison_ivy in forum ASP Programming
    Replies: 5
    Last Post: June 23rd, 2004, 03:51 AM
  2. GROUP BY & SUM problem
    By muis in forum MySQL Help
    Replies: 3
    Last Post: February 4th, 2004, 04:23 AM
  3. Replies: 3
    Last Post: January 31st, 2004, 12:16 AM
  4. Query to choose different values in field
    By angrypanda in forum MySQL Help
    Replies: 2
    Last Post: January 30th, 2004, 03:48 PM
  5. Database field problem
    By perler in forum Perl Programming
    Replies: 4
    Last Post: January 28th, 2004, 04:19 AM

IMN logo majestic logo threadwatch logo seochat tools logo