Hey, an alternative to your switch statement, is to have an associative array with the full State names in it like this ... $states = array('MI'=>'Michigan'); and so forth. then just uses it in your html.. $states['$state'];
Jason On Mon, 26 Jul 2004 15:28:11 -0400, Tom Ray [Lists] <[EMAIL PROTECTED]> wrote: > Hey all- > > I've run into a small bump in some code I'm writing for a membership > database. The first thing that needs to be done is an index of all > states in the US with members. The fun part is that the state > information is stored as the abbreviation in the database (ie MI, WI) > and the HTML page needs to display the full name of the State. I want to > display the information in a four column table that kicks out as many > rows as needed. Now in order to get the full name of the state, I'm > running the state result through a switch statement. Actaully, it's > working rather well expect for this little issue: > > Row 8: South Dakota Tennessee Texas Virgina > Row 9: West Virgina Wisconsin Texas Virgina > > I need to kill that extra Texas and Virgina.....here's how I'm doing this: > > <table border=1> > <? > $query=mysql_query("SELECT DISTINCT state FROM members WHERE > country='US' ORDER BY state ASC"); > while($q=mysql_fetch_array($query)) { > $q1=mysql_fetch_array($query); > $q2=mysql_fetch_array($query); > $q3=mysql_fetch_array($query); > $q4=mysql_fetch_array($query); > > (4 Switch statements here one for q1, q2, q3, q4) > ?> > > <tr><td><?= $state1 ?></td><td><?= $state2 ?></td><td><?= $state3 > ?></td><td><?= $state4 ?></td></tr> > > <? > } > ?> > > Any thoughts, let me know if more information is needed. > > TIA. > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php