November 22nd, 2000, 12:42 PM
-
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?
November 22nd, 2000, 12:57 PM
-
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]
November 22nd, 2000, 01:06 PM
-
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...
November 22nd, 2000, 02:59 PM
-
How would that '$var' attribute work? Do I have to pre set the variables?
November 22nd, 2000, 03:54 PM
-
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]
November 23rd, 2000, 05:23 PM
-
Thanks for that last post, That gave me a really good idea that fixed the whole issue. You guys rock.
Thanks again.