rasta876 Posted November 1, 2008 Share Posted November 1, 2008 Hey all, When I echo something from my database as below: echo &row['sentence']; I get an output such as: Hello Todayis Monday How do I eliminate get a space between Today and is to get: Hello Today is Monday In the database the spacing is quite allright. Thanks Quote Link to comment Share on other sites More sharing options...
genericnumber1 Posted November 1, 2008 Share Posted November 1, 2008 The problem is that there isn't a space in the database... you COULD add a space between all "today"s and "is"s, but that would obviously not fix any underlying problems. Quote Link to comment Share on other sites More sharing options...
AndyB Posted November 1, 2008 Share Posted November 1, 2008 If your database contains "Hello Todayis Monday" then that's your problem. If your output is actually something from the database and some other words that generate "Hello Todayis Monday", give us a precise example of what you really have. Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted November 1, 2008 Share Posted November 1, 2008 See if your database contains any "\n" or "\r" characters. These are ignored by the browser, but depending on how you're viewing the database will show up correctly (replaced by an html line break) or as a space. echo str_replace(array("\n", "\r"), " ", $database_row['fieldname']); 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.