php - Select and show states and respective cities from MySQL table -


i have sql table 2 fields: city , state. build simple list of states , respective cities, until not. this:

<ul> <li>new york     <ul>     <li>albany</li>     <li>buffalo</li>     <li>new york city</li>     </ul> </li> <li>illinois     <ul>     <li>chicago</li>     <li>rockford</li>     </ul> </li> </ul> 

i did below select, list states. can't find way show respective cities:

<?php $result = mysqli_query($con,"select distinct states,cities table order states"); while($row = mysqli_fetch_array($result)) {   // show here } ?> 

states be

$row['states'] 

cities

$row['cities'] 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -