Want to list countries and regions

I have a table of users with regions and countries for every user.
Now I would like to echo a list of all countries I have in every region.

Something like this:
EUROPE
France
Germany
Norway
Spain
Sweden

SOUTH AMERICA
Argentina
Brasil
Chile

NORTH AMERICA
Canada
USA

I tried the following, but it’s not working. What do I need to add/change in this?

SELECT DISTINCT continent FROM station_db ORDER BY country DESC;

<p><?php do { ?><?php echo $row_rs_countrylist['continent']; ?><?php echo $row_rs_countrylist['country']; ?></p>
<?php } while ($row_rs_countrylist = mysql_fetch_assoc($rs_countrylist)); ?>
  1. add the country column to the SELECT of your query (you can’t display what you didn’t get from the database…)
  2. use a while loop instead of a do-while loop (you have to fetch the first row before you display the data)
  3. use the mysqli_ or pdo extensions instead of mysql, because the mysql_ extension has been deprecated in PHP 5.5.0 and will be removed completely in the future.

Ok, I have to look that up. I’m using Dreamweaver and it makes the code. I just modify it.
And it seems like DW isn’t using mysqli… I keep forgetting about that…
So, I’m not sure about all the stuff you write… but I can Google it I guess.

Hmmm, I’m not sure how to make the query. What would it look like to get all the countries and continents, but group them by continent?