Let's say I have the following rows in my db: id name extra 1 New York 1.123 2 Chicago 1.645 3 Miami 2 4 Los Angeles 1.999 5 Las Vegas 1.462 6 Detroit 1.823 7 Toronto 1.1 PHP: What I want to do is pull them all (only the name filed) and get them in one array, so it would looks like this: "New York", "Chicago", "Miami", etc How would I do that?
Give this a try.. $resultArray = array(); $result = mysql_query("SELECT name FROM database"); while ($row = mysql_fetch_row($result)) { $resultArray[] = $row[0]; } PHP: