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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.