Functions can be looked up at www.php.net, trim is at
http://us2.php.net/manual/en/function.trim.php
"James Johnson"
<[EMAIL PROTECTED] To: <[EMAIL PROTECTED]>
s.com> cc:
Subject: RE: Form values are truncated
08/11/2003 12:00
PM
Hi Dan, all,
I don't know PERL, just coming back to speed on PHP after 3+ years with
ColdFusion.
Trim() is a function listed in my PHP Functions book, not something I
wrote.
It's supposed to: "removes all whitespace characters from both the left and
right ends of a string..." A space (ASCII 32) is considered a char to
remove, but since it's in the middle of the string, I don't understand why
it's being removed.
"or you could fix or replace the trim function with one that does not
remove
that data."
Is there a library of PHP user defined functions out there?
Thanks,
James
-----Original Message-----
From: Dan Muey [mailto:[EMAIL PROTECTED]
Sent: Monday, August 11, 2003 9:02 AM
To: James Johnson; [EMAIL PROTECTED]
Subject: RE: Form values are truncated
> All,
>
Howdy,
> I'm building a member signup form. Fields that contain more
> than one word are being truncated when being inserted into
> the MySQL table.
>
> I'm using this code that I got from one of my PHP books.
>
> $as_addr1 = addslashes($_POST['addr1']);$tr_addr1 = trim($as_addr1);
I think trim is trimming off the stuff after the first whitespace? What is
the trim function supposed to do?
Mysql isn't doing it your PHP is.
Use Perl and I bet it starts working :) ok, or you could fix or
replace the trim function with one that does not remove that data.
HTH
DMuey
>
> So, if I post "1122 Boogie St." it gets inserted as "1122".
> If I remove the "addslashes" portion, only using trim, I get
> the same result.
>
> Here's the query:
> $query = "INSERT INTO subscribers
> (email,password,fName,lName,addr1)
> VALUES
> ('$tr_email','$tr_pass','$tr_fName','$tr_lName','$tr_addr1'";
>
> echo $query;
>
> Here's the echo:
> INSERT INTO subscribers (email,password,fName,lName,addr1)
> VALUES('[EMAIL PROTECTED]','11111111','Jim','Johnson','78797 State')
>
> I have other fields in the table that are doing the same
> thing. All fields are varchars of varying length. Field
> "addr1" is varchar(50).
>
> Suggestions?
> Thanks,
> James
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]