fantic Posted October 17, 2008 Share Posted October 17, 2008 i made a table where catID and catName name is given and inserted different data when i want to show data and made query like this: "select CatName from table_name where CatID=category_id order by CatName ASC" than result shows like this: | NewMan | | NewVision | | Sherpa High Ambitions | | Abound Asian | | Above The Clouds | | Ace The Himalaya | | Acme Show | how i can fix this problem? Quote Link to comment https://forums.phpfreaks.com/topic/128810-blank-space-problem/ Share on other sites More sharing options...
JasonLewis Posted October 17, 2008 Share Posted October 17, 2008 So what's the problem exactly? Quote Link to comment https://forums.phpfreaks.com/topic/128810-blank-space-problem/#findComment-667803 Share on other sites More sharing options...
fantic Posted October 17, 2008 Author Share Posted October 17, 2008 problem is sorting Quote Link to comment https://forums.phpfreaks.com/topic/128810-blank-space-problem/#findComment-667810 Share on other sites More sharing options...
JasonLewis Posted October 17, 2008 Share Posted October 17, 2008 How do you want it to sort? Please explain your problem more clearly, because I still don't know what you want to do. Quote Link to comment https://forums.phpfreaks.com/topic/128810-blank-space-problem/#findComment-667813 Share on other sites More sharing options...
fantic Posted October 17, 2008 Author Share Posted October 17, 2008 the problem is in ordering result which is givan above. ordering is not correct. Quote Link to comment https://forums.phpfreaks.com/topic/128810-blank-space-problem/#findComment-667840 Share on other sites More sharing options...
PFMaBiSmAd Posted October 17, 2008 Share Posted October 17, 2008 There appear to be spaces at the start of the first 3 lines. You should always validate your data before inputting it into a database and if you don't want any spaces at the beginning or end of a string, you need to use the php trim() function on it before placing it into a query. Quote Link to comment https://forums.phpfreaks.com/topic/128810-blank-space-problem/#findComment-667953 Share on other sites More sharing options...
rhodesa Posted October 17, 2008 Share Posted October 17, 2008 you *should* be able to do: UPDATE table_name SET CatName = TRIM(CatName) MAKE SURE YOU BACKUP YOUR DATA BEFORE DOING GLOBAL UPDATES LIKE THIS Quote Link to comment https://forums.phpfreaks.com/topic/128810-blank-space-problem/#findComment-667960 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.