ltoto Posted September 19, 2006 Share Posted September 19, 2006 What i want to do is not a system where people can rate, but something where there will be a hotel which is stars, so i would want to show four stars , or if it is 5 i would want to show 5.this is the code of the page i would want to use it on:[code]<?phpmysql_select_db($database_conTotal, $conTotal);$query_rsHotels = "SELECT * FROM tabHotel";$rsHotels = mysql_query($query_rsHotels, $conTotal) or die(mysql_error());$row_rsHotels = mysql_fetch_assoc($rsHotels);$totalRows_rsHotels = mysql_num_rows($rsHotels);$sql="SELECT * FROM tabHotel WHERE regionId = $id";$result = mysql_query($sql);if (!$result) { die('Invalid query: ' . mysql_error());}while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $name = $row['hotelName']; $description = $row['hotelDescription']; $rating = $row['hotelRating']; $image = "<img src=\"../thumb/phpThumb.php?src=../images/hotel_{$row['hotelImage']}&w=100&h=100&zc=1\" alt=\"Hotel\">"; // List the hotels echo " <div class=\"homebar2\"><h1>".$name."</h1></div><div class=\"country\">".$image."</div> <div class=\"hotelcontent\">".$description."</div><h3>".$rating."</h3>\n";}mysql_free_result($rsHotels);?>[/code]i would want to you it on the $rating partin the backend of the site, the CMS, they can choose the ration via a drop down menu, either 3 start, 4 star or 5 startthe code for the dropdown is this:[code]<select name="selectRating" id="selectRating" title="<?php echo $row_rsAccomedit['hotelRating']; ?>"> <option value="3">3 Star</option> <option value ="4">4 Star</option> <option value ="5">5 Star</option> </select></td> </tr> <tr> <td><input name="hidId" type="hidden" id="hidId" value="<?php echo $row_rsAccomedit['Id']; ?>"></td> <td><input name="Submit" type="submit" class="btn" value="Edit"></td> </tr> </table> <input type="hidden" name="MM_update" value="form1">[/code]any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/21281-rating-system/ Share on other sites More sharing options...
otuatail Posted September 19, 2006 Share Posted September 19, 2006 You could sort by rating. Maybe have 5 images for effect But the next line needs changing.from$sql="SELECT * FROM tabHotel WHERE regionId = $id";to$sql="SELECT * FROM tabHotel WHERE regionId = " . $id; Quote Link to comment https://forums.phpfreaks.com/topic/21281-rating-system/#findComment-94696 Share on other sites More sharing options...
HuggieBear Posted September 19, 2006 Share Posted September 19, 2006 [quote]You could sort by rating. Maybe have 5 images for effect But the next line needs changing.from.....[/quote]No it doesn't, there's nothing wrong with that code. regionId is an integer, meaning no single quotes are required and as the $id is inside double quotes, the variable will be read, not a literal string.RegardsHuggie Quote Link to comment https://forums.phpfreaks.com/topic/21281-rating-system/#findComment-94707 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.