Hi everyone, I need a wee bit of help with the following.

I am calling all country names from a db table and echo-ing out each country name in a list format.

$query = "select * from countries order by Country Desc"; 

$result = mysql_query($query) or die(mysql_error());

while($row = mysql_fetch_array($result)){
    echo $row['Country'];
    echo "<br />";

this gives me a list of country names from the database, what I would like to do is have the list look like the following.

["country name 1", "country name 2", "country name 3", "country name 4"]

How can I acheive this, thanks

Sounds like you want json_encode()

$countries = array ();
while($row = mysql_fetch_array($result)){
    $countries[] = $row['Country'];
echo json_encode($countries);