Hi John
many thanks but I’m lost as usual
The View code shows some html and then what appears to be minified code
I unminified it but got only a few lianes out of all this
<div style="width:88%; margin:2em auto; background-color:#fff; border:solid 1px red; padding:1em;">
<code><span style="color: #000000">
<span style="color: #0000BB"><?php<br />error_reporting</span><span style="color: #007700">(</span><span style="color: #0000BB">E_ALL</span><span style="color: #007700">); </span><span style="color: #FF8000">// Show all error messages<br /></span><span style="color: #0000BB">ini_set</span><span style="color: #007700">(</span><span style="color: #DD0000">'display_errors'</span><span style="color: #007700">, </span><span style="color: #0000BB">true</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">// Your database preferences<br />// We are using constants instead of variables for this<br />// You can use either or<br /></span><span style="color: #0000BB">define</span><span style="color: #007700">(</span><span style="color: #DD0000">'HOST'</span><span style="color: #007700">, </span><span style="color: #DD0000">'localhost'</span><span style="color: #007700">); </span><span style="color: #FF8000">// Database host<br /></span><span style="color: #0000BB">define</span><span style="color: #007700">(</span><span style="color: #DD0000">'pintotou_*****'</span><span style="color: #007700">, </span><span style="color: #DD0000">'root'</span><span style="color: #007700">); </span><span style="color: #FF8000">// Database username<br /></span><span style="color: #0000BB">define</span><span style="color: #007700">(</span><span style="color: #DD0000">'*******'</span><span style="color: #007700">, </span><span style="color: #DD0000">'root'</span><span style="color: #007700">); </span><span style="color: #FF8000">// Database password<br /></span><span style="color: #0000BB">define</span><span style="color: #007700">(</span><span style="color: #DD0000">'pintotou_search'</span><span style="color: #007700">, </span><span style="color: #DD0000">''</span><span style="color: #007700">); </span><span style="color: #FF8000">// Database<br /></span><span style="color: #0000BB">define</span><span style="color: #007700">(</span><span style="color: #DD0000">'PATH_TO_IMAGES'</span><span style="color: #007700">, </span><span style="color: #DD0000">''</span><span style="color: #007700">); </span><span style="color: #FF8000">// /path_to-images/<br /><br />//=========================<br /></span><span style="color: #007700">function </span><span style="color: #0000BB">getImage</span><span style="color: #007700">(</span><span style="color: #0000BB">$chain</span><span style="color: #007700">=</span><span style="color: #0000BB">NULL</span><span style="color: #007700">)<br />{<br /> </span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #DD0000">'Hotel-default.jpg'</span><span style="color: #007700">;<br /><br /> switch (</span><span style="color: #0000BB">$chain</span><span style="color: #007700">) { <br /> case </span><span style="color: #DD0000">'Accor' </span><span style="color: #007700">: </span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #DD0000">'Accor.jpg'</span><span style="color: #007700">;<br /> break;<br /> case </span><span style="color: #DD0000">'Hilton' </span><span style="color: #007700">: </span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #DD0000">'Hilton.jpg'</span><span style="color: #007700">;<br /> break;<br /> case </span><span style="color: #DD0000">'Sheraton' </span><span style="color: #007700">: </span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #DD0000">'Sheraton.jpg'</span><span style="color: #007700">;<br /> break;<br /> case </span><span style="color: #DD0000">'Hotel-X' </span><span style="color: #007700">: </span><span style="color: #0000BB">$result </span><span style="color: #007700">= </span><span style="color: #DD0000">'Hotel-X.jpg'</span><span style="color: #007700">;<br /> break;<br /> }</span><span style="color: #FF8000">//endswitch<br /><br /> </span><span style="color: #007700">return </span><span style="color: #0000BB">PATH_TO_IMAGES </span><span style="color: #007700">.</span><span style="color: #0000BB">$result</span><span style="color: #007700">;<br />}<br /><br /></span><span style="color: #FF8000">/*<br />$searchq = filter_var("%{$_POST['keyword']}%", FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH); // Sanitize the string<br />$sql = "SELECT Chain, Country, City, Top, Medium, Low, Image FROM Chains WHERE Country LIKE ? OR City LIKE ?"; // Your query string<br />$prepare = $mysqli->prepare($sql); // Prepare your query string<br />$prepare->bind_param('ss', $searchq, $searchq); // Bind the placeholders to your search variables<br />// s = string | i = integer | d = double | b = blob<br />$prepare->execute(); // Execute the prepared statement<br />$prepare->store_result(); // Store the results for later checking<br /><br />// Use num_rows to check if the results return a 0 or 1. 0 meaning false and 1 meaning true<br />if($prepare->num_rows) {<br /> $prepare->bind_result($chain, $country, $city, $top, $medium, $low); // Append variables to the columns you specified<br /><br /> // Throw them all in a while loop<br /> while($prepare->fetch()) {<br /> // Technically you don't need to use HEREDOCS because if you end the PHP tag and restart it<br /> // You can have your full HTML in your PHP file<br /> // This isn't ideal though, you should separate your HTML from PHP, but since you are still a beginner<br /> // This doesn't really mean anything.<br /> // I'd say put these results in a new PHP file and require it<br /> $img = getImage($chain); Accor<br /> $img = '<img src="' .$img .'" alt="' .$city .'" />';<br />}<br />*/<br /><br />// KLUDGE: TO MAKE IT WORK <br />// THSES DEFAULTS SHOULD COME FROM DATABASE<br /></span><span style="color: #0000BB">$chain </span><span style="color: #007700">= </span><span style="color: #DD0000">'$chain'</span><span style="color: #007700">; <br /></span><span style="color: #0000BB">$country </span><span style="color: #007700">= </span><span style="color: #DD0000">'$country'</span><span style="color: #007700">; <br /></span><span style="color: #0000BB">$city </span><span style="color: #007700">= </span><span style="color: #DD0000">'$city'</span><span style="color: #007700">; <br /></span><span style="color: #0000BB">$top </span><span style="color: #007700">= </span><span style="color: #DD0000">'$top'</span><span style="color: #007700">; <br /></span><span style="color: #0000BB">$medium </span><span style="color: #007700">= </span><span style="color: #DD0000">'$medium'</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$low </span><span style="color: #007700">= </span><span style="color: #DD0000">'$low'</span><span style="color: #007700">; <br /><br /></span><span style="color: #0000BB">$img </span><span style="color: #007700">= isset( </span><span style="color: #0000BB">$_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">'keyword'</span><span style="color: #007700">] ) ? </span><span style="color: #0000BB">$_POST</span><span style="color: #007700">[</span><span style="color: #DD0000">'keyword'</span><span style="color: #007700">] : </span><span style="color: #0000BB">NULL</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$img </span><span style="color: #007700">= </span><span style="color: #0000BB">getImage</span><span style="color: #007700">(</span><span style="color: #0000BB">$img</span><span style="color: #007700">);<br /><br /><br /></span><span style="color: #0000BB">?></span><!DOCTYPE html><br /><html lang="en-GB"><br /><head><br /><meta charset="utf-8"><br /><title>How to get lowest Internet rates, anywhere</title><br /><meta name="viewport" content="width=device-width, initial-scale=1.0"><br /><meta name="description" content="Despite on-line claims the lowest Internet rates are offered by most major hotel websites"/><br /><meta name="keywords" content="" /><br /><link rel="stylesheet" href="http://pintotours.net/Pinto/articles.css"><br /><link href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700%7CRoboto+Slab:400,300' rel='stylesheet' type='text/css'><br /><style type="text/css"><br />.check{ width:25px; height:25px;}<br />table, th, td{ padding:0 30px;}<br />table, th, td p {font-family: Roboto; font-size:20px;} <br />#main h2{margin-bottom:0;}<br />#main p{text-align:center;font-family: AccorRoboto;font-size:18px;margin-top:0;}<br />#main .space p{word-spacing: 50px;padding-left:190px;clear:all;}<br />td {border:solid 1px #999;}<br /></style><br /></head><br /><body><br /><div id="header"><br /> <div id="logo1"><br /> <a href="/"><img src="http://pintotours.net/Pinto/images/whitelogo125.png" alt="Pinto Tours" width="125" height="85"></a><br /> </div><br /> <div class="globe"><img src="http://pintotours.net/Pinto/images/globe1.png" alt="The world of Pinto Tours"></div><br /> <div id="title"><br /> <h1>Travel Secrets</h1><br /> </div><!-- close title --><br /></div><!-- close header --><br /><br /><div id="nav"><br /> <ul><br /> <li><a href="/"><img src="http://pintotours.net/Pinto/images/Home.jpg" alt="Pinto Tours"></a></li><br /> <li><a href="/Americas/DomRepublic/Punta.php">Punta Cana</a></li><br /> <li><a href="/Americas/DomRepublic/StoDomingo.php">Santo Domingo</a></li><br /> <li><a href="/Europe/Spain/Barcelona.html">Barcelona</a></li><br /> <li><a href="/Asia/India/India.php">India</a></li><br /> <li><a href="/Asia/Indonesia/indonesia.php">Jakarta</a></li><br /> <li><a href="/Asia/Indonesia/bali.php">Bali</a></li><br /> <li><a href="/Asia/Japan/airportHnd.html">Japan</a></li><br /> <li><a href="/Oceania/Australia/Sydney.html">Sydney</a></li><br /> </ul><br /></div><!-- close nav --><br /><br /><div id="wrapper"><br /> <div id="main"><br /> <h2> You searched for hotels in ......</h2><br /><br /> <p> The following chains guarantee the lowest rates on the Internet</p><br /><br /><div class="space"><p>5* 4* 3*</p></div><br /> <table><br /><br /><span style="color: #0000BB"><?php </span><span style="color: #007700">if( isset(</span><span style="color: #0000BB">$img</span><span style="color: #007700">) ) { </span><span style="color: #0000BB">?><br /></span> <tr><br /> <td> <span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #0000BB">$img</span><span style="color: #007700">; </span><span style="color: #0000BB">?></span></td><br /> <td> <span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #0000BB">$chain</span><span style="color: #007700">; </span><span style="color: #0000BB">?></span></td><br /> <td> <span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #0000BB">$country</span><span style="color: #007700">; </span><span style="color: #0000BB">?></span></td><br /> <td> <span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #0000BB">$city</span><span style="color: #007700">; </span><span style="color: #0000BB">?></span></td><br /> <td> <span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #0000BB">$top</span><span style="color: #007700">; </span><span style="color: #0000BB">?></span></td><br /> <td> <span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #0000BB">$medium</span><span style="color: #007700">; </span><span style="color: #0000BB">?></span></td><br /> <td> <span style="color: #0000BB"><?php </span><span style="color: #007700">echo </span><span style="color: #0000BB">$low</span><span style="color: #007700">; </span><span style="color: #0000BB">?></span></td><br /> </tr><br /><span style="color: #0000BB"><?php </span><span style="color: #007700">}else{ </span><span style="color: #0000BB">?><br /></span> <tr><br /> <td colspan="6">There were no search results!</td><br /> </tr><br /><br /><span style="color: #0000BB"><?php </span><span style="color: #007700">} </span><span style="color: #0000BB">?><br /></span> </table><br /><br /><br /><br /> <div class="search" style="text-align:center;"><br /> <br /><br /><br /><br /> <form action="?" method="POST"><br /> <input type="text" class="textinput" name="keyword" id="keyword" size="30" ><br /> <input type="submit" value="Search" class="button"/><br /> </form><br /> Hotels: <br /> Accor Hilton Sheraton<br /> <br /><br /> </div><br /><br /><br /><br /><br /><br /><br /><br /> </div><!-- close Main --><br /><br /> <div id="side"><br /> <div id="logo"><br /> <a href="/"><img src="http://pintotours.net/Pinto/images/whitelogo125.png" alt="Pinto Tours" width="125" height="85"></a><br /> </div><br /> <div id="inside"><br /> <h3>Do not disturb my bags</h3><br /> <a href="http://pintotours.net/Pinto/article2.html"><p>The first thing many travellers do on arrival at a hotel is to unpack and place their carefully chosen clothes and accessories in the various cupboards and drawers available in the hotel room. Hopefully, they will still be there when it is time to leave....Full article...</p></a><br /> <hr><br /> <h3>How safe are hotel safes?</h3><br /> <a href="http://pintotours.net/Pinto/article3.html"><p>Your laptop, camera, money and other valuables are items that you may have to leave in the “safety” of the hotel when you travel. Are the safe deposit boxes in the guest rooms or those located in Reception sufficiently secure?...Full article...</p></a><br /> <hr><br /> <h3>Don't let the 'runs' ruin your holiday</h3><br /> <a href="http://pintotours.net/Pinto/article4.html"><p>Travelling to distant, exotic places, where the general standards of hygiene leave a lot to be desired is an invitation to gastrointestinal disorders, more commonly the dreaded traveller’s diarrhoea....Full article...</p></a><br /> <hr><br /> <h3>If you lose everything</h3><br /> <a href="http://pintotours.net/Pinto/article5.html"><p>Imagine that you are in rural China and you lose your wallet with all your money, credit cards, passport and other documents, with mobile phone and laptop to top it all. You do not speak Chinese and cannot find anyone that speaks a language that you understand... Full article...</p></a><br /> <hr><br /> <br><br><br /> </div><!-- close inside --><br /> </div><!-- close side --><br /></div><!-- close wrapper --><br /><br /><div id="footer"><br /> <ul><br /> <li><a href="Privacy.html">Privacy Policy</a></li><br /> <li><a href="Terms.html">Terms of use</a></li><br /> <li><a href="About.html">About</a></li><br /> <li><a href="mailto:&#97;&#100;&#109;&#105;&#110;&#64;&#112;&#105;&#110;&#116;&#111;&#116;&#111;&#117;&#114;&#115;&#46;&#110;&#101;&#116;">Contact</a></li><br /> </ul><br /> <br><br /> <p>&#169; 2013-2016 Pinto Tours. All Rights Reserved</p><br /></div><!-- close footer --><br /><br /><script><br />(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){<br />(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),<br />m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)<br />})(window,document,'script','//www.google-analytics.com/analytics.js','ga');<br /><br />ga('create', 'UA-40629899-1', 'auto');<br />ga('send', 'pageview');<br /><br /></script><br /><br /><div style="width:88%; margin:2em auto; background-color:#fff; border:solid 1px red; padding:1em;"><br /> <span style="color: #0000BB"><?php highlight_file</span><span style="color: #007700">(</span><span style="color: #0000BB">__FILE__</span><span style="color: #007700">); </span><span style="color: #0000BB">?><br /></span></div><br /></body><br /></html></span>
</code></div>
</body>
</html>
I can’ even see it in notepad++
How do I get to the code?
meanwhile I’ve bee n working hard trying to work out what you sent me earlier and don’t quite understand what to do with the function
I did this : is it correct?
function getImage($chain=‘NULL’)
{
$result = ‘img_chain-default.jpg’;
switch ($chain) {
case “Accor” : $result = ‘img_chain-AccorTest.jpg’;
break;
case ‘Hilton’ : $result = ‘chain-HiltonTest.jpg’;
break;
case ‘IHG’ : $result = ‘chain-IHGTest.jpg’;
break;
case ‘Melia’ : $result = ‘chain-MeliaTest.jpg’;
break;
case 'Marriott' : $result = 'chain-MarriottTest.jpg';
break;
}//endswitch
return PATH_TO_IMAGES .$result;
}
Look where I go so far:
http://pintotours.net/TEMP/SPACE/test10.html
Seacrch for “Brussels”