php - Display categories from a database -
i updating my site. can see have list of catagories (example: free offers, gifts, accessories).
these catagories list promotions , link single page , each 1 of promotion saved in mysql under dbname xclocouk_mobile
, table mobi
, each 1 has promo_cat
field name category underneath it.
i know how connect database. want know how index page read , display list of catagories found under promo_cat listed above?
i need them list title shown on page done manually. not want display duplicates.
how can accomplish this?
$q = "select promo_cat mobi"; $result = mysql_query($q,$connection); while($output = mysql_fetch_array($result)) { echo $output['category']; }
edit:
this list duplicates if there duplicates in database, else won't.
if have duplicates in db, use "select distinct(promo_cat) .. "
Comments
Post a Comment