Hi now, "James Johnson" <[EMAIL PROTECTED]>, Montag, 11. August 2003 17:49: > All, > > 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); > > 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.
removing the addslashes() has no effect on your input. this is only to add backslashes in front of any quotation mark like '. if you're trying to insert "Boo'gie St.", the ' in the middle of the word will terminate the mysql string and continue with something else --> _very dangerous_ since the user may be able to do about anything with your database! > > Here's the query: > $query = "INSERT INTO subscribers > (email,password,fName,lName,addr1) > VALUES > ('$tr_email','$tr_pass','$tr_fName','$tr_lName','$tr_addr1'"; i suppose you just forgot to mention the ) here at the end... > > echo $query; > > Here's the echo: > INSERT INTO subscribers (email,password,fName,lName,addr1) > VALUES('[EMAIL PROTECTED]','11111111','Jim','Johnson','78797 State') by now, anything should be ok with your INSERT query. at least as long as you send to the database exactly what is shown here. maybe we should take a closer look at the way you get your data back from MySQL? how did you do this? using the command line client, phpmyadmin or your own (PHP) application? maybe it's really some quotation problem as stated in another posting here (by Keith C. Ivey). > > 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 -- Yves Goergen [EMAIL PROTECTED] Please don't CC me (causes double mails) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]