In mysql, the table consist of informationtype, status and informationno ,

$information = mysql_query("SELECT * FROM table WHERE informationtype='message' AND status='waiting'");
$row = mysql_fetch_assoc($information);
$result=($row['informationno']);

The query result are 4 rows. The informationno are 11001; 11002; 11007; 11009;

If I intend to express the results in term of ( 11001, 11002, 11007, 11009)

Recommended Answers

All 6 Replies

your problem is not clear...What you really want to do specify more clearly.....
I cann't understand what do you hoping to build ???
Tell us the oupput more clearly so that we can think about it and provide you with the solution...

Here is your query

$information = mysql_query("SELECT informationtype, status and informationno,
         GROUP_CONCAT(DISTINCT informationno 
                   ORDER BY informationno SEPARATOR ',')
         FROM table
         WHERE informationtype='message' AND status='waiting'
         GROUP BY informationtype, status");

Thanks! This is what exactly i want! I want to ask how to show the result on the php?

Mark the thread as solved if your problem is solved.....

I have given infolist column alias, you can use it in your php code.

$information = mysql_query("SELECT informationtype, status ,
         GROUP_CONCAT(DISTINCT informationno 
                   ORDER BY informationno SEPARATOR ',') as INFOLIST
         FROM table
         WHERE informationtype='message' AND status='waiting'
         GROUP BY informationtype, status");

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.