0

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)

3
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by cliffcc
0

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...

Edited by tomato.pgn: n/a

0

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");

Edited by urtrivedi: n/a

0

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

0

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");

Edited by urtrivedi: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.