How do i select all from database and do while loop with them
Try with this:

   $results = db_select('cities', 'c')
    -&gt;fields('c')
    -&gt;execute()
    -&gt;fetchAll(PDO::FETCH_ASSOC);

   foreach ($results as $result){
    $city_id = $result['city_id'];
    $city_name = $result['city_name'];
   }