Rommeo Posted April 16, 2011 Share Posted April 16, 2011 For example you are searching for the username "userPHP" I want a result like : user1 user335 userAllyss userPHP | male | 26 years old | likes computers and sea userRed userMad userZero What I really want is; I want to print the data in the middle, not at the first or last. Is there a keyword for this for mySQL ? ( I have a users table username | gender | age | hobbies ) Quote Link to comment https://forums.phpfreaks.com/topic/233871-how-to-take-a-result-like-this/ Share on other sites More sharing options...
Rommeo Posted April 16, 2011 Author Share Posted April 16, 2011 any ideas ?? Quote Link to comment https://forums.phpfreaks.com/topic/233871-how-to-take-a-result-like-this/#findComment-1202429 Share on other sites More sharing options...
Pikachu2000 Posted April 16, 2011 Share Posted April 16, 2011 I don't follow. What exactly are you trying to do? Quote Link to comment https://forums.phpfreaks.com/topic/233871-how-to-take-a-result-like-this/#findComment-1202431 Share on other sites More sharing options...
Rommeo Posted April 16, 2011 Author Share Posted April 16, 2011 I want to print the "search-word" in the middle of all words, if I do : select * from users where user = %userphp% order by username ASC it will give me the result like userphp userxyz userzero.. but I want it like userabc userpepe userphp userxyz userzero so if the user was actually trying to find userpepe, he/she needs just to click "userpepe", that s what I m trying to do. ( notice that 2 usernames before the "search-word" and two usernames after "search-word" in the result I m trying to get ) Quote Link to comment https://forums.phpfreaks.com/topic/233871-how-to-take-a-result-like-this/#findComment-1202435 Share on other sites More sharing options...
fenway Posted April 19, 2011 Share Posted April 19, 2011 I don't follow -- are you saying that mysql is giving you the correct results, but you just want to format to output differently? Quote Link to comment https://forums.phpfreaks.com/topic/233871-how-to-take-a-result-like-this/#findComment-1203440 Share on other sites More sharing options...
Rommeo Posted April 23, 2011 Author Share Posted April 23, 2011 I don't follow -- are you saying that mysql is giving you the correct results, but you just want to format to output differently? Exacty, I just mean that, how can I take the results that are before the correct result and print them ? I need two queries ? or is there a keyword/function for to do that ? Quote Link to comment https://forums.phpfreaks.com/topic/233871-how-to-take-a-result-like-this/#findComment-1205199 Share on other sites More sharing options...
fenway Posted April 24, 2011 Share Posted April 24, 2011 Sounds like you just want to sort() in php. Quote Link to comment https://forums.phpfreaks.com/topic/233871-how-to-take-a-result-like-this/#findComment-1205584 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.