xero Posted October 11, 2006 Share Posted October 11, 2006 Hello everyone.Been looking around this nice site a little now and started to get a hang of things, but i've been bugged with a little something.I'm trying to show all results from a mysql query in one line.i.e:[code]SELECT handle FROM users[/code]A simple querry that will print out all the handles from a table, tryed to loop a little but i'm not shure how to make it show all lines.How can i extract all of the results easly into a single variable (not array) as a text line? i.e: $variable = "handle1, handle2, handle3"Might be only me that aint thinking straight. Hope someone can give me a little boost here :) Quote Link to comment Share on other sites More sharing options...
TEENFRONT Posted October 11, 2006 Share Posted October 11, 2006 Not entirly sure what you mean mate...one line?if it what i think you mean, then a loop should work. so $variable will loop through and show handle1 for the first entry, then handle2 for the second entry etc. Quote Link to comment Share on other sites More sharing options...
printf Posted October 11, 2006 Share Posted October 11, 2006 Something like....[code]SELECT GROUP_CONCAT(DISTINCT handle SEPARATOR ', ') AS handles FROM users;[/code]me! 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.