siamiam Posted July 10, 2009 Share Posted July 10, 2009 This is the code I currently have. $result = mysql_query("SELECT DISTINCT city, state FROM exp_weblog_data"); while($row = mysql_fetch_array($result)) { echo $row['city'] . ", " . $row['state']; echo "<br />"; } It outputs something "New York, NY". I need to take that information a split it between two arrays like the following (for an autosuggest script)... $city = array( "New York", "Los Angeles", "Miami" ); $state = array( "NY", "CA", "FL" ); I've been going in circles trying to figure it out on my own. Any direction would be greatly appreciated. Thanks Quote Link to comment Share on other sites More sharing options...
Psycho Posted July 10, 2009 Share Posted July 10, 2009 $result = mysql_query("SELECT DISTINCT city, state FROM exp_weblog_data"); while($row = mysql_fetch_array($result)) { echo $row['city'] . ", " . $row['state']; echo "<br />"; $cities[] = $row['city']; $states[] = $row['state']; } Quote Link to comment Share on other sites More sharing options...
siamiam Posted July 10, 2009 Author Share Posted July 10, 2009 Thank you so much for taking the time to help. I really appreciate it. Funny, something so small had me hung up for so long. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.