ltoto Posted October 20, 2006 Share Posted October 20, 2006 ok so this is what i have done[code]<?// List the hotelsecho " function cutit ($var, $max){return (strlen( $var ) > $max) ? substr($var, 0, $max).'...' : $var;}echo strip_tags(cutit($row_rsTour['pagesContent'], 350)); <div class=\"homebar2\"><h1>".$name."</h1></div><div class=\"hotel\">".$image."</div><div class=\"hotelcontent\">".$description."</div><h3><img src=\"".$star."\" hspace=\"2\"></h3>\n";}?>[/code]this is the full code from this page....[code]<?php$colname_rsHotels = "1";if (isset($_GET['Id'])) { $colname_rsHotels = (get_magic_quotes_gpc()) ? $_GET['Id'] : addslashes($_GET['Id']);}mysql_select_db($database_conTotal, $conTotal);$query_rsHotels = sprintf("SELECT * FROM tabHotel WHERE Id = %s", $colname_rsHotels);$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\">"; ?><?if ($row['hotelRating'] == 3){$star = "../images/star3.jpg";}else if ($row['hotelRating'] == 4){$star = "../images/star4.jpg";}else if ($row['hotelRating'] == 5){$star = "../images/star5.jpg";}?><?// List the hotelsecho " function cutit ($var, $max){return (strlen( $var ) > $max) ? substr($var, 0, $max).'...' : $var;}echo strip_tags(cutit($row_rsTour['pagesContent'], 350)); <div class=\"homebar2\"><h1>".$name."</h1></div><div class=\"hotel\">".$image."</div><div class=\"hotelcontent\">".$description."</div><h3><img src=\"".$star."\" hspace=\"2\"></h3>\n";}?><? mysql_free_result($rsHotels);?>[/code]what have i do wrong Quote Link to comment Share on other sites More sharing options...
Barand Posted October 20, 2006 Share Posted October 20, 2006 You aren't defining the function, you are just echoing the code that would define it.Remove the "echo" from the front of the function definition. Quote Link to comment 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.