xProteuSx Posted November 24, 2007 Share Posted November 24, 2007 I have a varchar field in one of my databases. I can insert a string such as 'this string is the data in the field' but when I go to display the data is displays 'this'. It seems that no matter what I type in it will not display the first space or anything beyond it. How do I fix this? Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/78665-solved-trouble-with-mysql-data-field-and-spaces/ Share on other sites More sharing options...
rajivgonsalves Posted November 24, 2007 Share Posted November 24, 2007 what is your code ? how are you inserting the data Quote Link to comment https://forums.phpfreaks.com/topic/78665-solved-trouble-with-mysql-data-field-and-spaces/#findComment-398040 Share on other sites More sharing options...
xProteuSx Posted November 24, 2007 Author Share Posted November 24, 2007 When creating the table the column is defined as follows: users_school varchar (30) default NULL Now, I am looking at the entries via myPhpAdmin and I have, for example, the value 'University of Florida' in this column. When I go to output this string, I do the following: $result = mysql_query("SELECT users_school FROM users WHERE users_handle='bob")or die(mysql_error()); if (mysql_num_rows($result) > 0) { while($row = mysql_fetch_row($result)) { echo $row[0]; } } This will give me the output: 'University' Quote Link to comment https://forums.phpfreaks.com/topic/78665-solved-trouble-with-mysql-data-field-and-spaces/#findComment-398047 Share on other sites More sharing options...
rajivgonsalves Posted November 24, 2007 Share Posted November 24, 2007 what does it show in the view source of the page ? Quote Link to comment https://forums.phpfreaks.com/topic/78665-solved-trouble-with-mysql-data-field-and-spaces/#findComment-398048 Share on other sites More sharing options...
xProteuSx Posted November 24, 2007 Author Share Posted November 24, 2007 I don't know what I did, but everything is working now. Curious. But its already 3 am, so I won't pry or complain. Thanks for replying. Quote Link to comment https://forums.phpfreaks.com/topic/78665-solved-trouble-with-mysql-data-field-and-spaces/#findComment-398053 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.