A better way to display this data from MySql using php -
i have data in table:
id | type ------------ 1 | 1 2 | 1 3 | 2 4 | 2 5 | 3 6 | 3 6 | 3 i need display data this:
type 1 --all type ones go here type 2 -- type twos go here type 3 type threes go here the way right using 2 separate sql statements , loops.
select distinct type type table while() { select type table type = type; while() { } } is there better way , results want, or using 2 loops way?
- change query using
order type asc. - loop through results, build associative array key type, , values ids.
now have 1 loop, , ids can accessed type associative array. should trivial loop through array key, , show ids key.
Comments
Post a Comment