Jump to content

Google Maps API & PHP Star Rating System


lash077

Recommended Posts

I am using the Google Maps API and a MySQL database to store the marker location. I am looking to add a php rating system to the Google Maps InfoWindow that I have put together.

 

Below is the link for the Map: http://andrewmccrum.com/maps/database/

 

And here is the link for the Rating System that also uses a MySQL database and PHP http://andrewmccrum.com/maps/rate/5star.php

 

<?php
mysql_connect("localhost", "username", "password") or die(mysql_error());
mysql_select_db("andrewmc_googlemaps") or die(mysql_error());

$query = mysql_query("SELECT * FROM markers");

while($row = mysql_fetch_array($query)) {
$rating = (int)$row[rating];
?>
<div class="floatleft">
	<div id="rating_<?php echo $row[id]; ?>">
		<span class="star_1"><img src="star_blank.png" alt="" <?php if($rating > 0) { echo"class='hover'"; } ?> /></span>
		<span class="star_2"><img src="star_blank.png" alt="" <?php if($rating > 1.5) { echo"class='hover'"; } ?> /></span>
		<span class="star_3"><img src="star_blank.png" alt="" <?php if($rating > 2.5) { echo"class='hover'"; } ?> /></span>
		<span class="star_4"><img src="star_blank.png" alt="" <?php if($rating > 3.5) { echo"class='hover'"; } ?> /></span>
		<span class="star_5"><img src="star_blank.png" alt="" <?php if($rating > 4.5) { echo"class='hover'"; } ?> /></span>
	</div>
</div>
<div class="star_rating">
	(Rated <strong><?php echo $rating; ?></strong> Stars)
</div>

<div class="clearleft"> </div>
<?php	
}

?>

 

I basically would like to include the rating system into the Google Maps InfoWindow at each marker.

Link to comment
https://forums.phpfreaks.com/topic/194678-google-maps-api-php-star-rating-system/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.