ltoto Posted September 20, 2006 Share Posted September 20, 2006 this is what i have done:[code]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\">"; if ($row['hotelRating'] == 3){//echo '<img src="star.gif" hspace="2">'}else if ($row['hotelRating'] == 4){//echo '<img src="star2.gif" hspace="2">'}else if ($row['hotelRating'] == 5){//echo '<img src="star3.gif" hspace="2">'} // List the hotels echo " <div class=\"homebar2\"><h1>".$name."</h1></div><div class=\"hotel\">".$image."</div> <div class=\"hotelcontent\">".$description."</div><h3>".$rating."</h3>\n";}[/code]any ideas of where to put these bits which are in it if ($row['hotelRating'] == 3){//echo '<img src="star.gif" hspace="2">'}else if ($row['hotelRating'] == 4){//echo '<img src="star2.gif" hspace="2">'}else if ($row['hotelRating'] == 5){//echo '<img src="star3.gif" hspace="2">'}anu suggestions? Link to comment https://forums.phpfreaks.com/topic/21377-rating-system-code-help-needed-solved/ Share on other sites More sharing options...
HuggieBear Posted September 20, 2006 Share Posted September 20, 2006 I'd stick it in a variable...[code]<?phpif ($row['hotelRating'] == 3){$star = "star.gif";}else if ($row['hotelRating'] == 4){$star = "star2.gif";}else if ($row['hotelRating'] == 5){$star = "star3.gif";}// List the hotelsecho "<div class=\"homebar2\"><h1>".$name."</h1></div><div class=\"hotel\">".$image."</div><div class=\"hotelcontent\">".$description."</div><h3><img src=\"".$star."\" hspace=\"2\"></h3>?>[/code]RegardsHuggie Link to comment https://forums.phpfreaks.com/topic/21377-rating-system-code-help-needed-solved/#findComment-95159 Share on other sites More sharing options...
ltoto Posted September 20, 2006 Author Share Posted September 20, 2006 for example like this:[code]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\">"; $star =if ($row['hotelRating'] == 3){$star = "star.gif";}else if ($row['hotelRating'] == 4){$star = "star2.gif";}else if ($row['hotelRating'] == 5){$star = "star3.gif";}// List the hotelsecho "<div class=\"homebar2\"><h1>".$name."</h1></div><div class=\"hotel\">".$image."</div><div class=\"hotelcontent\">".$description."</div><h3><img src=\"".$star."\" hspace=\"2\"></h3>?>mysql_free_result($rsHotels);?>[/code] Link to comment https://forums.phpfreaks.com/topic/21377-rating-system-code-help-needed-solved/#findComment-95161 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.