Q:

multiple marker by condition in map

<script type="text/javascript">
      function initMap() {
        var map;
        var bounds = new google.maps.LatLngBounds();
        var mapOptions = {
          mapTypeId: 'roadmap'
        };

        // Display a map on the page
        map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
        map.setTilt(45);

        var markers = [];
        var infoWindowContent = [];

        <?php   
        $query = "select id, dealer, lat, lon, dtype from dealer_m_testing where status = '1' and deleted is NULL"; 
        $query .= " order by seq asc";
        $dealers = mysql_query($query);
        if(mysql_num_rows($dealers) > 0){
          $i=0;
          while($dealer = mysql_fetch_array($dealers)){ ?>
            var marker = [];
            marker.push('<?php echo $dealer['id']; ?>');
            marker.push('<?php echo $dealer['dealer']; ?>');
            marker.push('<?php echo $dealer['lat']; ?>');
            marker.push('<?php echo $dealer['lon']; ?>');
            marker.push('<?php echo $dealer['dtype']; ?>');
            markers.push(marker);
            <?php
          }
        } ?>

        // Loop through our array of markers & place each one on the map  
        for( i = 0; i < markers.length; i++ ) {
          var position = new google.maps.LatLng(markers[i][2], markers[i][3], markers[i][4]);
          bounds.extend(position);
          marker = new google.maps.Marker({
            id: markers[i][0],
            position: position,
            map: map,
            title: markers[i][1],
            if (markers[i][4]=='P')
                    icon: 'https://trivenialmirah.com/img/red.png';
            else if (markers[i][4]=='R')
                    icon: 'https://trivenialmirah.com/img/blue.png';
            }
          });

          // Allow each marker to have an info window    
          google.maps.event.addListener(marker, 'click', (function(marker, i) {
            return function() {
                showDetails(marker.id);
            }
          })(marker, i));

          // Automatically center the map fitting all markers on the screen
          map.fitBounds(bounds);

        }

        // Override our map zoom level once our fitBounds function runs (Make sure it only runs once)
        var boundsListener = google.maps.event.addListener((map), 'bounds_changed', function(event) {
          //this.setZoom(1);
          google.maps.event.removeListener(boundsListener);
        });

      }

    </script>

A:

If you have these images https://trivenialmirah.com/img/red.png saved in your application, what you can do is rename them based on the value of dtype that is pushed to your markers array.
https://trivenialmirah.com/img/P.png
https://trivenialmirah.com/img/R.png

that way you can now do something similar to this
marker = new google.maps.Marker({
  id: markers[i][0],
  position: position,
  map: map,
  title: markers[i][1],
  icon: `https://trivenialmirah.com/img/${markers[i][4]}.png`;   
});

