OK, let's say I have a mysql database called "brian_stickers".
And in this database, I have a table called "location".
And in this table, I have two fields, "city" and "state".
Let's say, I want to extract all the cities within a particular state.
Let's say, I also want to sort these cities in alphabetical order.
From various web-tutorials, I was able to produce this:
I tried going back and modding it with some if() statements (to use cities within a particular state) and some ksort() statements (to sort those cities), but let's face it, I'm an idiot and have no clue what I'm doing.
I was hoping someone here could lend a hand. I checked out http://www.php.net, but I'm half-retarded and no matter how hard I try, I can't understand 95% of what's written there.
And in this database, I have a table called "location".
And in this table, I have two fields, "city" and "state".
Let's say, I want to extract all the cities within a particular state.
Let's say, I also want to sort these cities in alphabetical order.
From various web-tutorials, I was able to produce this:
PHP:
<?php
$db = mysql_connect("localhost", "brian_stickers");
mysql_select_db("brian_stickers",$db);
$result = mysql_query("SELECT * FROM location",$db);
while ($myrow = mysql_fetch_row($result)) {
printf("%s", $myrow[0]);
}
?>
I was hoping someone here could lend a hand. I checked out http://www.php.net, but I'm half-retarded and no matter how hard I try, I can't understand 95% of what's written there.