View Single Post
Old 06-15-2011, 02:17 PM  
sarettah
see you later, I'm gone
 
Industry Role:
Join Date: Oct 2002
Posts: 14,115
What I was saying in icq:

Code:
<?php

include("../includes/connect.php");


$query="select city_id, city_name from city order by city_name";
if ($city_result = $db->query($query)) 
{
  $id = 17;
  $query = "model_id, city_id from model_in_city 
        	  WHERE model_id = $id
            AND city_display = 1";
  if ($result = $db->query($query)) 
  {
    echo "<select name=select multiple>";
    while ($cityrow = $city_result->fetch_assoc()) 
    {
      echo "<option value=" . $cityrow['city_id'] 
      mysql_data_seek($result,0);
      while($model_city=mysql_fetch_array($result))
      {
        if($model_city['city_id']==$cityrow['city_id'])
        {
          echo " selected ";
        }
      }
      echo ">" . $cityrow['city_name'] . "</option>";
  }
  echo "</select>";
  $result->free();
}
$db->close();
?>
__________________
All cookies cleared!
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote