Jump to content

ltoto

Members
  • Posts

    162
  • Joined

  • Last visited

    Never

Everything posted by ltoto

  1. Ok So what i have at the moment is something where in the front end of the website it shows a coutry name, and a list of regions within the country. e.g Spain: Murica, Madrid then when they click on the region the list of hotels appear within this region on a new page. In the SQl i have 3 tables, 1 called Country, one called Region, and one called Hotels. Country table: id countryName Region Table id regionname countryId ( this is picking up the id from the first table ) Hotels table id hotelname hotelrating countryname regionId( picking the Id up from the region table ) hoteltype and this is the code I have done this in in the front end [code]<?php if(@$_GET['Id']== "15") { ?> <?php $sql="SELECT c.countryName, c.countryImage, r.regionName, r.Id FROM tabCountry c, tabRegion r WHERE c.Id = r.countryId"; $result = mysql_query($sql); if (!$result) {   die('Invalid query: ' . mysql_error()); } $country = "null"; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){   $cheader = $row['countryName'];   if (strcmp($country,$cheader) !=0){   $country = $row['countryName'];   echo <<<HTML   <br>   <div class="homebar2"><h1>$cheader</h1></div> <div class="country">  <img src="../thumb/phpThumb.php?src=../images/country_{$row['countryImage']} &amp;w=100&amp;h=100&amp;zc=1"  alt="Latest Deals">  </div>  HTML;   } echo <<<HTML <div class="countrycontent"><a href="index.php?Id=16&id={$row['Id']}">{$row['regionName']}</a><br></div> HTML; } ?> <?php } ?>[/code] and then it goes through to the hotels page, with this code ... [code]<?php mysql_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\">";  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 hotels echo "<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] this is all working fine, for hotels but now the client has asked that if this can be done for 3 different types: Hotels ( which is done ) Golf Villas so I added the hoteltype to the hotels table in the SQL as you can see, and what I was thinking of is that, when they are entering all this in the backend of the site, they ca nselect th hotel type, and it will go to that page e.g if it is Villa then go to Id=19 any suggestions on how I can do this? i tried using case, but all the records just follow the first hotelId, this si the coase code i used: [code]switch($row_rsAccomodation['hotelType']) { case 'Hotel':   if($row_rsPages['Id']== "15")   include "pages/country.php";   break; case 'Villa':   if($row_rsPages['Id']== "3")   include "pages/country_villa.php";   break;      case 'Golf':   if($row_rsPages['Id']== "2")   include "pages/country_golf.php";   break;      default:     break;   } ?>[/code] any suggestions please...
  2. right so I have changed the top bit so it has the get id in there now which is this: [code]$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);[/code] and this is the link index.php?Id=22&Id=$row[Id] now it is picking up the right id number, but itsn't going to the right place, because i already have a link with the id on so maybe i need to some how rename the second Id part in the link, how do i do this....
  3. thanks for that, i will sleep on now and look into tomoz, thanks again
  4. right, i have fixed one part of the code on this page now, so the code now look slike this: [code]<?php mysql_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\">";    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";   } echo "<div class=\"homebar2\"><h1>$name</h1></div>\n";   echo "<div class=\"hotel\">$image</div>\n";   echo "<div class=\"hotelcontent\">" . substr($description, 0, 300) . "...</div>\n";   echo "<h3>Hotel Star: <img src=\"$star\" hspace=\"2\"></h3>\n"; echo "<div class=\"moreinfo\"><a href=\"index.php?Id=22&id=$row[Id]\"><img src=\"../images/moreinfo.jpg\" alt=\"moreinfo\" width=\"75\" height=\"18\" border=\"0\"></a></div>\n"; } ?> <? mysql_free_result($rsHotels);?>[/code] now i still need to fix the link problem from this ndex.php?Id=22&id=$row[Id] with this id=$row[Id] bit, it picks up the id from something else, as i have already used a link like this on another include page, which is this: index.php?Id=16&id={$row['Id']}">{$row['regionName']} and suggestions how to get it to pick up thehotel Id???
  5. do the \ lines make it work in the php quote then i guess, btw, thanks a lot that works fine, i just need to change the link at the bottom now
  6. i understanding more now, but i got an error from this part of the code   echo "<div class=\"moreinfo\"><a href=\"index.php\?Id=22&id=$row['Id']\"><img src="../images/moreinfo.jpg" alt=\"moreinfo\" width=\"75\" height=\"18\" border=\"0\"></a></div>\n"; which was arse error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in after this is done, will have a read through all of this, understand it even more, just that people are making me rush it...
  7. i cant use tables  ;D, tabless website.. thanks for the advice, i tired it at home but it didnt seem to work, but i will have a play around
  8. sorry for triple post, just that i have until half past 5 to do it and i am a bit miffed, andysugesstions or do i need o tadd somthing else
  9. the link at the top of the page that I am putting this link on is this http://development4.jbswebdesign.co.uk/index.php?Id=20&id=1: i have and include on the pages page which is this: <?php if(@$_GET['Id']== "22") { include('pages/accom.php'); } ?> on this page from the code in the post above i wrote the link as this: <a href="index.php?Id=22&id=<? echo $row_rsHotels['Id']; ?>" but obviously this would be the same as the one at the top of the post. i have found that it is picking the right id number up, but seems to be going to the wrong table in the sql when clicking on it?
  10. 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\">";  how would i go about echoing this out then... sorry im a bit of newb, i kind of understnad when i see it, normally i would look it up, buy ive been put in a rush by the client
  11. my problem though is, i can find out what the probel is, but i cant write it properly in code....
  12. well, the code i have below is repeating the same record over and over again, instead of changin the records: this is the code [code]<?php mysql_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\">";  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"; } ?> <?php ?> <?php do { ?> <div class="homebar2"><h1><?php echo $name; ?></h1> </div> <div class="hotel"><?php echo $image; ?></div> <div class="hotelcontent"><?php echo substr($description, 0, 300); ?>...</div> <h3>Hotel Star: <img src="<?php echo $star; ?>" hspace="2"></h3> <div class="moreinfo"> <a href="index.php?Id=22&id=<?php echo $row_rsHotels['Id']; ?>"><img src="../images/moreinfo.jpg" alt="moreinfo" width="75" height="18" border="0"></a></a></div> <?php } while ($row_rsHotels = mysql_fetch_assoc($rsHotels)); ?> <?php } ?> <? mysql_free_result($rsHotels); ?>[/code] and here the link to the page it is doing it on: http://development4.jbswebdesign.co.uk/index.php?Id=20&id=1 any suggestions as to what i can do or change?
  13. Heres the code to the 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"; } ?> <?php ?> <div class="homebar2"><h1><?php echo $name; ?></h1></div> <div class="hotel"><?php echo $image; ?></div> <div class="hotelcontent"><?php echo substr($description, 0, 300); ?>...</div> <h3>Hotel Star: <img src="<?php echo $star; ?>" hspace="2"></h3> <div class="moreinfo"> <a href="index.php?Id=22"><img src="../images/moreinfo.jpg" alt="moreinfo" width="75" height="18" border="0"></a></a></div> <?php } ?> <? mysql_free_result($rsHotels); ?>[/code] what do I do to this link index.php?Id=22 so that it also picks up the hotel Id aswell if that makes sense??? becausewhat I am trying to do is make it so it clicks on the hotel id, and all the info from tht page shows up. thanks alot..
  14. thanks a lot mate, that helped a lot
  15. apologies for the triple post, i cant delete my posts i didnt explain my self clear in the post above, when i say the ... bit i mean so it goes like this.... ggrtretertertett.... when it cuts the text off this is my code at the moment: [code]echo "> <div class=\"homebar2\"><h1>".$name."</h1></div><div class=\"hotel\">".$image."</div><div class=\"hotelcontent\">".substr($description, 0, 300);"</div><h3><img src=\"".$star."\" hspace=\"2\"></h3> \n"; }[/code] thanks a lot
  16. how do i put like the .... in after this
  17. thanks alot, you are right about the summary thing aswell!!  ;D
  18. sorry, I dunno y i pu them in, what i want to do is strip the $description part to, and then they can click on a more info button the read more about that page!
  19. i want to put strip tags around this text [code]<? // List the hotels echo "> <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 for the page... [code]<?php mysql_select_db($database_conTotal, $conTotal); $query_rsHotels = "SELECT * FROM tabHotel WHERE hotelType = 'hotelType'"; $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 hotels echo "> <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] can anyone help pleeeeeease.....?
  20. ok so this is what i have done [code]<? // List the hotels echo " 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 hotels echo " 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
  21. so now i need to add something to this code i guess because its now showing each hotel on each section [code]<?php $sql="SELECT tabCountry.countryName, tabCountry.countryImage, tabRegion.regionName, tabRegion.Id FROM tabCountry , tabRegion  WHERE tabCountry.Id = tabRegion.countryId"; $result = mysql_query($sql); if (!$result) {   die('Invalid query: ' . mysql_error()); } $country = "null"; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){   $name = $row['countryName'];   if (strcmp($country,$name) !=0){       $country = $row['countryName'];       echo <<<HTML           <br> <div class="homebar2"><h1>$name</h1></div> <div class="country">  <img src="../thumb/phpThumb.php?src=../images/country_{$row['countryImage']}&amp;w=100&amp;h=100&amp;zc=1"  alt="Latest Deals">  </div>          HTML;   } echo <<<HTML <div class="countrycontent"><a href="index.php?Id=16&id={$row['Id']}">{$row['regionName']}</a><br></div> HTML; } ?>[/code]
  22. the reason i have different pages though, is because the client asked for a hotel page, a villas page, and a golf page
  23. ok so this is what is happening everthing you have said si correct there are 3 hotel types, Golf, hotel, and Villa each has a different Id page e.g Golf Id = 3 Hotel Id = 15 Villa Id= 2 when they go on a page, e.g the hotels page, a list of coutrys will come up ( these countrys are added in the Admin side of the website ) and within the country, a list of regions show that are with the country, so it wil appaer like this for example: SPAIN : Murica, Madrid  the code used to do this is [code]<?php $sql="SELECT tabCountry.countryName, tabCountry.countryImage, tabRegion.regionName, tabRegion.Id FROM tabCountry , tabRegion  WHERE tabCountry.Id = tabRegion.countryId"; $result = mysql_query($sql); if (!$result) {   die('Invalid query: ' . mysql_error()); } $country = "null"; while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){   $name = $row['countryName'];   if (strcmp($country,$name) !=0){       $country = $row['countryName'];       echo <<<HTML           <br> <div class="homebar2"><h1>$name</h1></div> <div class="country">  <img src="../thumb/phpThumb.php?src=../images/country_{$row['countryImage']}&amp;w=100&amp;h=100&amp;zc=1"  alt="Latest Deals">  </div>          HTML;   } echo <<<HTML <div class="countrycontent"><a href="index.php?Id=16&id={$row['Id']}">{$row['regionName']}</a><br></div> HTML; } ?>[/code] this code is on the country.php page, and is the same on country_villa and country_hotel apart from the link at the bottom where i have changed the Id to o  to the right place. When i region is clicked on, it goes to a new page, with the list of hotels within that region done with this code: [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 hotels echo "<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] so what happens at the moment is that the villa, golf and hotel, hotels appear on each page, but what i am tryin to do is get it that on the hotel page, it just hsows the hotel, hotels on the villa page the villa ones, and the golf page, the golf ones.....
  24. everything is updating fine, it just seems to be taking everything with the first Id, but not actually changing the other ones, to get it on everypage i could do this [code]<? if(@$_GET['Id']=="15") include 'country.php'; else if(@$_GET['Id']=="2") include 'country_villa.php'; else if(@$_GET['Id']=="3") include 'country_golf.php';?> <?php switch($row_rsHotel['hotelType']) { case 'Hotel': if(@$_GET['Id']== "15") break; case 'Villa': if(@$_GET['Id']== "2"); break; case 'Golf': if(@$_GET['Id']== "3"); break; default: break; } ?>[/code] but it still wouldnt solve the problem, but it would get it on the right pages
  25. any ideas at all as to why this is happening.................
×
×
  • 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.