Jump to content

teknojunkey

Members
  • Posts

    32
  • Joined

  • Last visited

    Never

Everything posted by teknojunkey

  1. I get this error .. Parse error: syntax error, unexpected T_ELSE in ....../simple_search.php on line 100 here is the full page ... <?php $searchParam=''; $childage=''; if($_POST) { $lineid=trim($_POST['lineid']); $shipid=trim($_POST['shipid']); $regionid=trim($_POST['regionid']); $sdate=trim($_POST['sdate']); $edate=trim($_POST['edate']); $adults=trim($_POST['adults']); $children=trim($_POST['children']); $departuk=trim($_POST['departuk']); echo $departuk; for($i=1;$i<=$children;$i++) { $childage.='<child age="'.trim($_POST['childage'.$i]).'" />'; if($i==1) $ca=trim($_POST['childage'.$i]); else $ca=",".trim($_POST['childage'.$i]); } if(!empty($lineid)) $searchParam.=' lineid="'.$lineid.'"'; if(!empty($shipid)) $searchParam.=' shipid="'.$shipid.'"'; if(!empty($regionid)) $searchParam.=' regionid="'.$regionid.'"'; if (!empty($sdate) && !empty($edate)) $searchParam.=' startdate="'.$sdate.'" enddate="'.$edate.'"'; elseif (!empty($sdate)) $searchParam.=' startdate="'.$sdate.'" enddate="'.$edate.'"'; $searchParam.=' adults="'.$adults.'"'; $searchParam.=' children="'.$children.'"'; } //echo $ca; //startdate="2011-02-01" enddate="2011-02-28" lineid="22" adults="2" children="1" if(!empty($childage)) $encodeString=urlencode('<?xml version="1.0"?><request><auth username="...." password="...." /><method action="simplesearch" sitename="www.site.co.uk" currency="GBP" status="Test" type="cruise"><searchdetail resultkey="default" sid="...." type="cruise" '.$searchParam.'>'.$childage.'</searchdetail></method></request>'); else $encodeString=urlencode('<?xml version="1.0"?><request><auth username="...." password="...." /><method action="simplesearch" sitename="www.......co.uk" currency="GBP" status="Test" type="cruise"><searchdetail resultkey="default" sid="....." type="cruise" '.$searchParam.'></searchdetail></method></request>'); //echo $encodeString;exit; $ch = curl_init("http://fusionapi.traveltek.net/0.9/interface.pl"); curl_setopt( $ch, CURLOPT_URL, "http://fusionapi.traveltek.net/0.9/interface.pl?xml=".$encodeString); // url to post curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 ); // return into a variable curl_setopt($ch, CURLOPT_TIMEOUT, 200); //curl_setopt( $ch, CURLOPT_HTTPHEADER, $header ); // headers from above $tmp = curl_exec( $ch ); // runs the post curl_close($ch); $doc = simplexml_load_string($tmp); //echo $doc->results->cruise['name']; /*echo "<pre>"; print_r($doc); exit;*/ /*for($i=0;$i<count($doc->results->cruise[9]->regions->region);$i++) { echo $doc->results->cruise[9]->regions->region[$i]['name']; } exit;*/ //$arrRegion=explode(";",$region); $sessionKey=$doc->request->method['sessionkey']; //echo count($doc->results->cruise); //echo $doc->results->cruise->regions->region['name']; //print_r($doc->results->cruise); //print_r($_SESSION['qResult']); //exit; include 'pagination_class.php'; // Create the pagination object $starting=0; $recpage = 10;//number of records per page $obj = new Pagination_class($doc->results->cruise,$starting,$recpage); if ($departuk == "true"){ if ($data[$i]['departuk'] == 'Y'){ $result = $obj->result; } else { echo "do some thing else"; } else { echo "there was a problem"; } //$result = $obj->result; //print_r($result); ?> this is where the data is displyed .... <form name="form1" action="testpage.php" method="POST"> <input type="hidden" value="<?php echo $lineid; ?>" name="lineid"> <input type="hidden" value="<?php echo $shipid; ?>" name="shipid"> <input type="hidden" value="<?php echo $regionid; ?>" name="regionid"> <input type="hidden" value="<?php echo $sdate; ?>" name="sdate"> <input type="hidden" value="<?php echo $edate; ?>" name="edate"> <input type="hidden" value="<?php echo $adults; ?>" name="adults"> <input type="hidden" value="<?php echo $children; ?>" name="children"> <input type="hidden" value='<?php echo $ca; ?>' name="childage"> <input type="hidden" value='<?php echo $searchParam; ?>' name="sp"> <table border="1" align="center" width="40%"> <tr><TD colspan="2"> <div id="page_contents"> <?if(count($result)!=0){?> <table border="1" align="center" width="100%"> <tr><TD colspan="2"><? echo $obj->anchors; ?></TD></tr> <tr><TD colspan="2"><? echo $obj->total; ?></TD></tr> </table> <?php $counter = $starting + 1; foreach ($result as $data) { $region=''; $ports=''; $ukl=''; for($i=0;$i<count($data->regions->region);$i++) { if(empty($region)) $region.= $data->regions->region[$i]['name']; else $region.=", ". $data->regions->region[$i]['name']; } for($i=0;$i<count($data->ports->port);$i++) { if(empty($ports)) $ports= "<b>".$data->ports->port[$i]['name']."<b>"; else $ports.=" ><b> ". $data->ports->port[$i]['name']."<b>"; } for($i=0;$i<count($data['departuk']);$i++) { if(empty($ukl)) $ukl= "<b>".$data[$i]['departuk']."<b>"; else $ukl.=" ><b> ". $data[$i]['departuk']."<b>"; } ?> <div class="cruiseresult2" id="longrow_<?php echo $data['resultno'];?>"> <div id="shortrow_<?php echo $data['resultno'];?>"> <div class="resultInfo"> <div class="left"> <h2 class="cruisename"><img height="15" width="20" src="http://static0.traveltek.net/images/dynapack/cruise.gif" alt="Cruise" /> <?php echo $data['name']; ?> - <?php echo $region;?></h2> <p class="cruisedetail2">On the <a href="line_detail.php?sessionkey=<?php echo $sessionKey; ?>&chosencruise=<?php echo $data['resultno'];?>&lineid=<?php echo $data->line['id']?>"><?php echo $data->line['name'];?></a> ship <a href="/fusion/detailship3.pl?sessionkey=<?php echo $sessionKey;?>&chosencruise=<?php echo $data['resultno'];?>&shipid=<?php echo $data->ship['id'];?>"><?php echo $data->ship['name'];?></a> <?php echo date('jS M Y',strtotime($data['enddate']));?> for <?php echo $data['nights'];?> Nights</p> <p><b>ship rating :</b> <img src="http://static3.traveltek.net/images/dynapack/star10.gif" style="margin-top: 3px;"><img src="http://static3.traveltek.net/images/dynapack/star10.gif" style="margin-top: 3px;"><img src="http://static3.traveltek.net/images/dynapack/star10.gif" style="margin-top: 3px;"><img src="http://static3.traveltek.net/images/dynapack/star10.gif" style="margin-top: 3px;"></p> <?php echo $data[$i]['departuk']; if ($data[$i]['departuk'] == 'N'){ echo "works"; } else{ echo "disnywork"; } ?> </div> <div class="right" style="text-align: center;"> <div class="cruiseresult2-img"> <a href="<?php echo $data->ship['imageurl'];?>" rel="lightbox"><img height="68px" width="118px" src="<?php echo $data->ship['smallimageurl']?>" style="border: 1px solid rgb(153, 153, 153);"></a> </div><div class="clear"></div> <img border="0" src="<?php echo $data->line['logourl'];?>" alt="<?php echo $data->line['name'];?>" title="<?php echo $data->line['name'];?>"> </div> <div class="clear"></div> <div style="font-weight: bold;" class="ports">cruise ports : <?php echo $ports;?></div> </div> <div class="clear" style="height: 10px;"></div> <table width="100%" cellspacing="0" cellpadding="0"> <tbody><tr> <td> <div class="priceColLeft"> <table cellspacing="0" cellpadding="0" name="pricegrid" class="pricegrid"> <tbody><tr> <th width="120px" style="padding: 0pt 0pt 0pt 10px;"> </th> <th width="70px" align="left">inside</th> </tr><tr> <td style="padding: 0pt 0pt 0pt 10px; color: rgb(51, 51, 51);">Cruise Only</td> <td><b><?php if($data['startprice']>0) echo "&#163;".$data['startprice'];else echo "-";?></b></td> </tr></tbody> </table> </div> </td> <td valign="bottom"> <div class="priceColRight"> <!-- Get Prices --> <a href="cruise_detail.php?sk=<?php echo $sessionKey; ?>&chosencruise=<?php echo $data['resultno'];?>&sid=<?php echo $data->ship['id'];?>&cid=<?php echo $data['codetocruiseid'];?>"><img src="http://static1.traveltek.net/images/www.simply-cruising.co.uk/btn-moredetails.gif" class="more"></a> </div> </td> </tr> </tbody></table> </div> <div class="spacer"><img src="http://static2.traveltek.net/images/cruisedemo.traveltek.net/images/spacer.gif"></div> </div> <? $counter ++; } ?> <table border="1" align="center" width="100%"> <tr><TD colspan="2"><? echo $obj->anchors; ?></TD></tr> <tr><TD colspan="2"><? echo $obj->total; ?></TD></tr> </table> <?}else{?> <table border="1" align="center" width="100%"> <tr><TD align="center" colspan="2">No Data Found</TD></tr> </table> <?}?> </TD></tr> </table> </div> </TD></tr> </table></form> thanks
  2. hi jes, advice to make the code work can you see any errors with it ? i want to filter results ... if the results have 'Y' they should be displayed or else not $result = $obj->result; thanks
  3. hi, I have a search page with a checkbox $departuk that returns the value "true" if checked. I want to return search results if this returns true and the flag 'Y' is available if ($departuk == "true"){ if ($data[$i]['departuk'] == 'Y'){ $result = $obj->result; } else{ echo "do some thing else"; } else{ echo"there was a problem"; } any pointers / advice is appreciated thanks
  4. I kind of figured it out, i used this ... but i still can access the cruiseline data $docResults = $doc->results->ship; I cant specify any of the [@attributes] array [results] => SimpleXMLElement Object ( [ship] => SimpleXMLElement Object ( [@attributes] => Array ( [adultsonly] => N [code] => [cruiseline] => African Safari Club [description] => M.S. Royal Star is fully stabilised and air-conditioned throughout and is ideal for cruising the islands of the Indian Ocean, as she is able to cruise close to shores and visit intriguing ports often inaccessible to larger ships. More importantly, with so few passengers there is no danger of overwhelming the character and often delicate ecosystem of the islands we visit, thus preserving what one has travelled to experience. Conditions permitting, the bridge is often open to passengers whilst at sea, which typifies the informality and similarly, the dress code is casual most evenings, although there will be one or two occasions when gentlemen will be expected to wear a jacket and tie. [hidden] => N i tried $docResults = $doc->results->ship->attributes->cruiseline; how can i access the elements in the [@attributes] => Array thanks
  5. thanks, the </pre> was part of the html, a sloppy copy and paste was to blame. i tried $docResults = $doc->response->results->ship->cruiseline; there was nothing returned i tried $docResults = $doc->response; i got this SimpleXMLElement Object ( ) i dont understand whats going on thanks
  6. Hi thanks again .. here is the xml ... from print_r ($tmpgs); <?xml version="1.0"?> <response method="getshipcontent" success="Y"> <errors> </errors> <request> <auth password="test" username="test" /> <method action="getshipcontent" shipid="16" sitename="www.mysite.co.uk" /> </request> <results> <ship adultsonly="N" code="" cruiseline="African Safari Club" description="M.S. Royal Star is fully stabilised and air-conditioned throughout and is ideal for cruising the islands of the Indian Ocean, as she is able to cruise close to shores and visit intriguing ports often inaccessible to larger ships. More importantly, with so few passengers there is no danger of overwhelming the character and often delicate ecosystem of the islands we visit, thus preserving what one has travelled to experience. Conditions permitting, the bridge is often open to passengers whilst at sea, which typifies the informality and similarly, the dress code is casual most evenings, although there will be one or two occasions when gentlemen will be expected to wear a jacket and tie. " hidden="N" id="16" launched="1956-01-12" length="367" lineid="6" name="M.S.Royal Star" niceurl="african-safari-club/msroyal-star" occupancy="200" ownerid="system" rating="2" starrating="2" supercedes="" tonnage="5600" totalcrew="137"> <cabintypes> <cabintype cabincode="1" cabintype="suite" caption="" description="All cabins have a private shower and wc, air conditioning, an internal telephone, taped music, a safe and adequate storage space. The majority are outside with a port-hole or window. However, port holes on Caribbean deck may be covered during adverse weather conditions. Most of the suites have two bathrooms, mini bar and hair dryer. " id="2044" imageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages/1243430599.jpg" name="President Suite(Outside)" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages_small/1243430599.jpg" /> <cabintype cabincode="2" cabintype="suite" caption="" description="All cabins have a private shower and wc, air conditioning, an internal telephone, taped music, a safe and adequate storage space. The majority are outside with a port-hole or window. However, port holes on Caribbean deck may be covered during adverse weather conditions. Most of the suites have two bathrooms, mini bar and hair dryer. " id="2045" name="Honeymoon Suite(Outside)" /> <cabintype cabincode="3" cabintype="suite" caption="" description="All cabins have a private shower and wc, air conditioning, an internal telephone, taped music, a safe and adequate storage space. The majority are outside with a port-hole or window. However, port holes on Caribbean deck may be covered during adverse weather conditions. Most of the suites have two bathrooms, mini bar and hair dryer. " id="2046" imageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages/1228299808.jpg" name="Superior Suite(Outside)" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages_small/1228299808.jpg" /> <cabintype cabincode="4" cabintype="cabin" caption="Deluxe Cabin (4)" description="All cabins have a private shower and wc, air conditioning, an internal telephone, taped music, a safe and adequate storage space. The majority are outside with a port-hole or window. However, port holes on Caribbean deck may be covered during adverse weather conditions. Most of the suites have two bathrooms, mini bar and hair dryer. " id="2047" imageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages/1220965161.jpg" name="Deluxe Cabin" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages_small/1220965161.jpg" /> <cabintype cabincode="A" cabintype="cabin" caption="" description="All cabins have a private shower and wc, air conditioning, an internal telephone, taped music, a safe and adequate storage space. The majority are outside with a port-hole or window. However, port holes on Caribbean deck may be covered during adverse weather conditions. Most of the suites have two bathrooms, mini bar and hair dryer. " id="2039" imageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages/1228299715.jpg" name="Standard Cabin" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages_small/1228299715.jpg" /> <cabintype cabincode="B" cabintype="cabin" caption="" description="All cabins have a private shower and wc, air conditioning, an internal telephone, taped music, a safe and adequate storage space. The majority are outside with a port-hole or window. However, port holes on Caribbean deck may be covered during adverse weather conditions. Most of the suites have two bathrooms, mini bar and hair dryer. " id="2040" imageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages/1228299697.jpg" name="Standard Cabin" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages_small/1228299697.jpg" /> <cabintype cabincode="B" cabintype="outside" caption="" description="All cabins have a private shower and wc, air conditioning, an internal telephone, taped music, a safe and adequate storage space. The majority are outside with a port-hole or window. However, port holes on Caribbean deck may be covered during adverse weather conditions. Most of the suites have two bathrooms, mini bar and hair dryer. " id="2041" imageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages/1228299678.jpg" name="Standard Cabin" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages_small/1228299678.jpg" /> <cabintype cabincode="C" cabintype="outside" caption="" description="All cabins have a private shower and wc, air conditioning, an internal telephone, taped music, a safe and adequate storage space. The majority are outside with a port-hole or window. However, port holes on Caribbean deck may be covered during adverse weather conditions. Most of the suites have two bathrooms, mini bar and hair dryer. " id="2042" imageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages/1228299314.jpg" name="Standard Cabin" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages_small/1228299314.jpg" /> <cabintype cabincode="D" cabintype="outside" caption="" description="All cabins have a private shower and wc, air conditioning, an internal telephone, taped music, a safe and adequate storage space. The majority are outside with a port-hole or window. However, port holes on Caribbean deck may be covered during adverse weather conditions. Most of the suites have two bathrooms, mini bar and hair dryer. " id="2043" imageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages/1228299293.jpg" name="Standard Cabin" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages_small/1228299293.jpg" /> <cabintype cabincode="E" cabintype="inside" caption="" description="All cabins have a private shower and wc, air conditioning, an internal telephone, taped music, a safe and adequate storage space. The majority are outside with a port-hole or window. However, port holes on Caribbean deck may be covered during adverse weather conditions. Most of the suites have two bathrooms, mini bar and hair dryer. " id="2048" imageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages/1243430769.jpg" name="Inside Cabin" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_cabinimages_small/1243430769.jpg" /> </cabintypes> <facilities> <facility category="Food and Drink" categoryid="1"> <item categoryid="1" description="" facilityid="187" facilitytypeid="187" name="Buffet" quantity="" /> <item categoryid="1" description="" facilityid="160" facilitytypeid="160" name="Lounge" quantity="" /> <item categoryid="1" description="" facilityid="196" facilitytypeid="196" name="Piano Bar" quantity="" /> <item categoryid="1" description="" facilityid="46" facilitytypeid="46" name="Restaurant" quantity="" /> </facility> <facility category="Other" categoryid="7"> <item categoryid="7" description="" facilityid="197" facilitytypeid="197" name="Boutique" quantity="" /> <item categoryid="7" description="" facilityid="1027" facilitytypeid="1027" name="Elevator" quantity="" /> <item categoryid="7" description="" facilityid="220" facilitytypeid="220" name="Laundry Service" quantity="" /> <item categoryid="7" description="" facilityid="175" facilitytypeid="175" name="Medical Centre" quantity="" /> <item categoryid="7" description="" facilityid="210" facilitytypeid="210" name="Shopping Gallery" quantity="" /> <item categoryid="7" description="" facilityid="223" facilitytypeid="223" name="Shore Excursion Office" quantity="" /> </facility> <facility category="Relaxation" categoryid="3"> <item categoryid="3" description="" facilityid="192" facilitytypeid="192" name="Beauty Salon" quantity="" /> <item categoryid="3" description="" facilityid="219" facilitytypeid="219" name="Massage" quantity="" /> <item categoryid="3" description="" facilityid="188" facilitytypeid="188" name="Sauna" quantity="" /> <item categoryid="3" description="" facilityid="225" facilitytypeid="225" name="Sun Deck" quantity="" /> <item categoryid="3" description="" facilityid="155" facilitytypeid="155" name="Swimming Pool" quantity="" /> </facility> <facility category="Entertainment" categoryid="2"> <item categoryid="2" description="" facilityid="163" facilitytypeid="163" name="Board/card games" quantity="" /> <item categoryid="2" description="" facilityid="156" facilitytypeid="156" name="Casino" quantity="" /> </facility> <facility category="Recreational" categoryid="5"> <item categoryid="5" description="" facilityid="64" facilitytypeid="64" name="Library" quantity="" /> <item categoryid="5" description="" facilityid="44" facilitytypeid="44" name="Outdoor Pool" quantity="" /> </facility> <facility category="Fitness" categoryid="4"> <item categoryid="4" description="" facilityid="148" facilitytypeid="148" name="Gym" quantity="" /> <item categoryid="4" description="" facilityid="882" facilitytypeid="882" name="Sports Deck" quantity="" /> </facility> </facilities> <images> <image caption="M.S.Royal Star " default="Y" id="9408" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243429202.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243429202.jpg" type="photo" /> <image caption="Casino" default="N" id="9427" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243429794.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243429794.jpg" type="photo" /> <image caption="Buffet" default="N" id="9421" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243429702.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243429702.jpg" type="photo" /> <image caption="Belvedere Restaurant" default="N" id="9414" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243429602.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243429602.jpg" type="photo" /> <image caption="Entertainment " default="N" id="9444" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243430158.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243430158.jpg" type="photo" /> <image caption="Back of Ship" default="N" id="9412" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243429620.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243429620.jpg" type="photo" /> <image caption="Cocktails" default="N" id="9429" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243429880.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243429880.jpg" type="photo" /> <image caption="Chefs" default="N" id="9431" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243429852.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243429852.jpg" type="photo" /> <image caption="Dining" default="N" id="9433" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243429875.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243429875.jpg" type="photo" /> <image caption="Crew" default="N" id="9436" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243429920.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243429920.jpg" type="photo" /> <image caption="Drinks on Deck" default="N" id="9441" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243430065.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243430065.jpg" type="photo" /> <image caption="Drinks on Deck 2 " default="N" id="9443" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243430085.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243430085.jpg" type="photo" /> <image caption="Entertainment 2" default="N" id="9445" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243430161.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243430161.jpg" type="photo" /> <image caption="Relaxing on Deck " default="N" id="9447" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243430153.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243430153.jpg" type="photo" /> <image caption="On the Bridge " default="N" id="9450" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243430201.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243430201.jpg" type="photo" /> <image caption="Starlight Piano Bar" default="N" id="9453" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243430346.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243430346.jpg" type="photo" /> <image caption="View On Deck" default="N" id="9456" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243430355.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243430355.jpg" type="photo" /> <image caption="Tender Boat" default="N" id="9455" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243430322.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243430322.jpg" type="photo" /> <image caption="View On Deck 2 " default="N" id="9459" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243430381.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243430381.jpg" type="photo" /> <image caption="View On Deck 3" default="N" id="9458" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243430369.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243430369.jpg" type="photo" /> <image caption="Ship 2" default="N" id="9460" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243430497.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243430497.jpg" type="photo" /> <image caption="Ship 3" default="N" id="9461" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243430452.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243430452.jpg" type="photo" /> <image caption="Ship 4 " default="N" id="9464" imageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_large/1243430536.jpg" ownerid="system" smallimageurl="http://imageserver.traveltek.net/cruisepics/local_shipimages_small/1243430536.jpg" type="photo" /> </images> </ship> </results> </response> </pre> any help or advice is appreciated
  7. thanks for your help and clarification... I tried this .. curl_setopt( $chgs, CURLOPT_RETURNTRANSFER, 1 ); // return into a variable curl_setopt($chgs, CURLOPT_TIMEOUT, 60); curl_setopt( $chgs, CURLOPT_HTTPHEADER, $header ); // headers from above $tmpgs = curl_exec( $chgs ); // runs the post curl_close($chgs); $doc = simplexml_load_string($tmpgs); echo $doc->results->ship->cruiseline; //print_r ($doc); only print_r seems to show results, echo displayed nothing thanks
  8. Hi, what is the best method for extracting information from xml there seems to be many different methods... here is the xml ... SimpleXMLElement Object ( [@attributes] => Array ( [method] => getshipcontent [success] => Y ) [errors] => SimpleXMLElement Object ( [0] => ) [request] => SimpleXMLElement Object ( [auth] => SimpleXMLElement Object ( [@attributes] => Array ( [password] => test [username] => test ) ) [method] => SimpleXMLElement Object ( [@attributes] => Array ( [action] => getshipcontent [shipid] => 453 [sitename] => www.mysite.co.uk ) ) ) [results] => SimpleXMLElement Object ( [ship] => SimpleXMLElement Object ( [@attributes] => Array ( [adultsonly] => N [codes] => [cruiseline] => African Safari Club [description] => From the moment you enter at reception, you will be assured a warm welcome and friendly smile from all staff on board. Facilities include a restaurant offering excellent views of the scenery as you pass by, two small gift shops, a large lounge with a bar and a laundry service. There is also a doctor available 24 hours a day. For your peace of mind, make sure you ask reception for a safety deposit box, which is available free of charge. Enjoy a cooling dip in the small swimming pool and relax with a refreshing drink at the pool bar. You can also be pampered by taking a massage in a secluded open-air area on deck. There is also table football and table tennis. Choose from a wide selection of items at the hot and cold buffet, whilst lunch and dinner are either buffet or waiter service. Enjoy a cabin service where you can purchase drinks of your choice between 0900 and 2300 hours. Evening entertainment includes occasional dancing and theme nights complete with belly-dancers. [hidden] => N [id] => 453 [launched] => 1989-01-01 [length] => 209 [lineid] => 6 [name] => M.S. Fleurette [niceurl] => african-safari-club/ms-fleurette [occupancy] => 93 [ownerid] => system [rating] => 4 [starrating] => 4 [supercedes] => [tonnage] => 1170 [totalcrew] => 0 ) I want to display [cruiseline] and [description] as html thanks[/code]
  9. sorry for wasting everyone's time there was a typo in the variable
  10. $content is a number 1234 can you point me in the right direction thanks
  11. Hi I can get this to work can you point me in the right direction curl_setopt( $ch, CURLOPT_URL, "http://website.com/action=%22getcontent%22%20shipid=%22\"$content\"%22%20/%3E%3C/request%3E"); I want to include the variable $content in the url thanks
  12. can you explain for stupid please
  13. Hi I want to get multiple rows from a db I am using this for the db query public function getCeleb($product_id) { $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_to_celeb WHERE product_id = '" . (int)$product_id . "'"); foreach ($query->rows as $result) { $celeb_id = $result['celeb_id']; } return $celeb_id; } and this to display the returned data 'celeb_id' => $result['celeb_id'] print_r ($celeb_id); the problem is i only get one result from the database and i have multiple entries with the same id thanks in advance
  14. here is the full function: public function addCeleb($data) { $this->db->query("INSERT INTO " . DB_PREFIX . "celeb SET parent_id = '" . (int)$data['parent_id'] . "', sort_order = '" . (int)$data['sort_order'] . "', date_modified = NOW(), date_added = NOW()"); $celeb_id = $this->db->getLastId(); if (isset($data['image'])) { $this->db->query("UPDATE " . DB_PREFIX . "celeb SET image = '" . $this->db->escape($data['image']) . "' WHERE celeb_id = '" . (int)$celeb_id . "'"); } foreach ($data['celeb_description'] as $language_id => $value) { $this->db->query("INSERT INTO " . DB_PREFIX . "celeb_description SET celeb_id = '" . (int)$celeb_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "'"); $this->db->query("INSERT INTO " . DB_PREFIX . "celeb SET cname = '" . $this->db->escape($value['name']) . "'"); } if ($data['keyword']) { $this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET query = 'celeb_id=" . (int)$celeb_id . "', keyword = '" . $this->db->escape($data['keyword']) . "'"); } $this->cache->delete('celeb'); }
  15. Hi I want to enter the same data into two tables, this is how i am trying to do it ... foreach ($data['celeb_description'] as $language_id => $value) { $this->db->query("INSERT INTO " . DB_PREFIX . "celeb_description SET celeb_id = '" . (int)$celeb_id . "', language_id = '" . (int)$language_id . "', name = '" . $this->db->escape($value['name']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', description = '" . $this->db->escape($value['description']) . "'"); $this->db->query("INSERT INTO " . DB_PREFIX . "celeb SET cname = '" . $this->db->escape($value['name']) . "'"); } this adds the data to the table ... however creates a second row in the table with blank details. what is the best way to do this ? thanks
  16. Hi I want to delete a row from a database without redirecting to a delete page, can i call a function from a link? or idealy have a javascript confirmation. thanks
  17. Hi I have glued a script together that will get the latitude and longetude values from google there are two options to do this 1st from a php form and 2nd from javascript. I would like to be able to enter the postcode in the field and have the map display the location, pass the returned coordinated to javascript here is a demo: http://dev.crocodile-communication.com/superglass/test-live/admin/getlat.php here is the script: <p>This tool will retrieve a latitude and longitude value.</p> <form action="#" method="post"> Enter Postcode:<input type="text" name="get_postcode"><input type="Submit"> </form> <? //vars $get_postcode=$_POST['get_postcode']; $myKey = 'ABQIAAAAAo5DJKafF5Wqy7iJIHvekxQDw6SbLitDXGRuCV60uhGEd-71JRQNyJ8twHQdwm4taRRWFLYUClMi7g'; $URL = "http://maps.google.co.uk/maps/geo?q=" . urlencode($get_postcode) . "&output=json&key=".$myKey; //decode returned file - echo $URL; $data = json_decode(file_get_contents($URL)); //get latitude and longetude coordinates $lng = $data->Placemark[0]->Point->coordinates[0]; $lat = $data->Placemark[0]->Point->coordinates[1]; ?> <p><b> Latitude <?=$lat?> <br> Longitude <?=$lng?> </b></p> <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAAo5DJKafF5Wqy7iJIHvekxQDw6SbLitDXGRuCV60uhGEd-71JRQNyJ8twHQdwm4taRRWFLYUClMi7g" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ function loadMap(){ var map = new GMap2(document.getElementById("map")); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng(54.80068486732233,-3.779296875), 5); GEvent.addListener(map, "click", function(overlay, point){ map.clearOverlays(); if (point) { map.addOverlay(new GMarker(point)); map.panTo(point); msg = "Latitude: "+point.lat()+"<br />"+"Longitude: "+point.lng(); document.getElementById("mypoint").innerHTML = msg; } }); } // arrange for our onload handler to 'listen' for onload events if (window.attachEvent) { window.attachEvent("onload", function() { loadMap(); // Internet Explorer }); } else { window.addEventListener("load", function() { loadMap(); // Firefox and standard browsers }, false); } //]]> </script> <div onLoad="loadMap()"> <div id="map" style="width: 400px; height: 400px"></div><br/> <div id="mypoint">Click on map to get Lat/Lon Values<br/></div> </div> </div> thanks for any advice
  18. Hi can anyone help ? I cant get this script to display the latitude and longitude I can see the file from this url that is created: http://maps.google.co.uk/maps/geo?q=g783pj&output=json&key=ABQIAAAAAo5DJKafF5Wqy7iJIHvekxQDw6SbLitDXGRuCV60uhGEd-71JRQNyJ8twHQdwm4taRRWFLYUClMi7g <? $postcode = "glasgow"; $myKey = 'ABQIAAAAAo5DJKafF5Wqy7iJIHvekxQDw6SbLitDXGRuCV60uhGEd-71JRQNyJ8twHQdwm4taRRWFLYUClMi7g'; $URL = "http://maps.google.co.uk/maps/geo?q=" . urlencode($postcode) . "&output=json&key=".$myKey; $data = file($URL); $data = json_decode($data[0]); $long = $data->Placemark[0]->Point->coordinates[1]; $lat = $data->Placemark[0]->Point->coordinates[2]; echo $URL; return array('Latitude'=>$lat,'Longitude'=>$long); echo $lat; echo $long; ?> but i cannot display the coordinates I dont know much about json so this might be the problem this is my server details Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.1 json json support enabled json version 1.2.1 thanks for any advice
  19. the tshirts are loaded from a db, so theres not much chance of adding them to the background image. I would also like to add more than one image to the images stack, eg. print, buttons, logo so i have to load an image into a specific div on the page. any thoughts? thanks
  20. I want to create a preview of what a t-shirt would look like with a print on it. so you have an image .. a red t-shirt say and then you can add a design over it, a gif or png (im not interested in IE) I was thinking of doing this in flash, but js seemed to be simpler :s ! the code i added replaces the image on selecting an item from the dropdown, but i want them on top of each other. Idealy loaded in another div, then i can control the position and depth with css. thanks
  21. This should do it Css .tablestyle {cursor:crosshair;} html <table class="tablestyle"> ....etc ....etc </table>
  22. Hi Im trying to stack images on top of each other with a dropdown list, however all i can do is replace them. Is this possible with js and can i load them into empty div's ? <SCRIPT> // preload images var img1 = new Image().src = "/images/jht.gif" var img2 = new Image().src = "/images/jsht.gif" var img3 = new Image().src = "/images/pht.gif" function setImage(imageSelect) { theImageIndex = imageSelect.options[imageSelect.selectedIndex].value; if (document.images) document.images[0].src = eval("img" + theImageIndex); } </SCRIPT> </HEAD><BODY> <FORM NAME="theForm" METHOD="POST"> <div>Images: <SELECT NAME="items" onChange="setImage(this)"> <OPTION VALUE="1">Image 1 <OPTION VALUE="2">Image 2 <OPTION VALUE="3">Image 3 </SELECT> </div> <div id="far"><IMG SRC = "/images/base_image.gif" ></div> </FORM> </BODY>
×
×
  • 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.