mikafi Posted September 11, 2011 Share Posted September 11, 2011 I have troubles inserting varchar to mySQL table containing space (" "). Whenever the string has space in it, the inserting fails and nothing is added to the table. My php code looks like this in terms of inserting values: $query="INSERT INTO table VALUES ('null', '$name', '$score', '$description', CURRENT_TIMESTAMP)"; It does work when there are no spaces in either name or description which are VARCHARs. Is it normal that this fails when the strings contain a space? Quote Link to comment Share on other sites More sharing options...
Pandemikk Posted September 11, 2011 Share Posted September 11, 2011 Never heard of this before. So you're telling me if the $name variable was: "A Name" it would not insert into the database? Could you post your mysql query? What is the length of the varchar? Quote Link to comment Share on other sites More sharing options...
fenway Posted September 11, 2011 Share Posted September 11, 2011 First, you haven't listed the column names -- that's a no-no. Second, you're quoting 'null' -- guaranteed that's not what you mean. Third, as suggested, echo the actual query, since what you describe is impossible. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.