Jump to content

usman07

Members
  • Posts

    310
  • Joined

  • Last visited

    Never

Everything posted by usman07

  1. Thats doesn't seem to work, What i want is for the echo to be on the next line? i thort thats what <br /> is used for.
  2. I have an echo here, and not sure where about's I can put <br /> and want to be able to style it in the css (need to create a div class or something on it) Thank You echo 'address="' . parseToXML($row['address']) . '" ';
  3. Thanks mate, i got it sorted eventually.
  4. Need help with this, has anyone does this before? Here is the tutorial I have been following: https://developers.google.com/maps/articles/phpsqlajax#outputxml The part I am on from the tutorial is where it says Checking that XML output works it is meant to display the data from the database but i just get a blank page, no data is shown from my database on the page? I just have a php file with the code from the tutorial.
  5. I honestly dont't understand this, any help is appreciated,heres the full code of the page: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Mumtaz Properties</title> <link rel="stylesheet" href="cutouts/style.css"/> </head> <body> <!--Main Div Tag--> <div id="wrapper"> <div id="header"> <div id="logo"><a href="index.php"><img src="cutouts/Homepage/logo.png" alt=""/></a></div> </div> <div id="navigation"> <a id="Home" href="index.php" title="home"><span>home</span></a> <a id="Sale" href="forsale.html" title="for sale"><span>for sale</span></a> <a id="Rent" href="forrent.html" title="for rent"><span>for rent</span></a> <a id="Contact" href="contact.html" title="contact us"><span>contact us</span></a> </div> <div id="main"> <center><div id="pheader"><img src="cutouts/maps/pheader.png" alt=""/></div></center> <?php require("mstr_ref2.php"); function parseToXML($htmlStr) { $xmlStr=str_replace('<','<',$htmlStr); $xmlStr=str_replace('>','>',$xmlStr); $xmlStr=str_replace('"','"',$xmlStr); $xmlStr=str_replace("'",'&#39;',$xmlStr); $xmlStr=str_replace("&",'&',$xmlStr); return $xmlStr; } // Opens a connection to a MySQL server $connection=mysql_connect ("mysql10.000webhost.com", $username, $password); if (!$connection) { die('Not connected : ' . mysql_error()); } // Set the active MySQL database $db_selected = mysql_select_db($database, $connection); if (!$db_selected) { die ('Can\'t use db : ' . mysql_error()); } // Select all the rows in the markers table $query = "SELECT * FROM markers WHERE 1"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)){ // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'name="' . parseToXML($row['name']) . '" '; echo 'address="' . parseToXML($row['address']) . '" '; echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lng'] . '" '; echo 'type="' . $row['type'] . '" '; echo '/>'; } // End XML file echo '</markers>'; ?> </div> <div id="footer"> <a id="fHome" href="index.php" title="homepage"><span>homepage</span></a> <a id="fSale" href="forsale.html" title="for sale"><span>for sale</span></a> <a id="fRent" href="forrent.html" title="for rent"><span>for rent</span></a> <a id="fContact" href="contact.html" title="contact us"><span>contact us</span></a> </div> </div> </body> </html>
  6. Ok iv changed the mstr_ref2.php to this: <? $username=""; $password=""; $database=""; ?> And this is in the map.php page: // Opens a connection to a MySQL server $connection=mysql_connect (localhost, $username, $password); if (!$connection) { die('Not connected : ' . mysql_error()); } This is the error I receive: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'a2221438_usman'@'localhost' (using password: YES) in /home/a2221438/public_html/map.php on line 44 Free Web Hosting Not connected : Access denied for user 'a2221438_usman'@'localhost' (using password: YES) But when I change the map.php page code to this: // Opens a connection to a MySQL server $connection=mysql_connect ("mysql10.000webhost.com", $username, $password); if (!$connection) { die('Not connected : ' . mysql_error()); } It them comes up with this error message: This page contains the following errors: error on line 56 at column 1: Extra content at the end of the document Below is a rendering of the page up to the first error. This is the line 56, what it wrong with it for the error message to appear?Thanks $query = "SELECT * FROM markers WHERE 1";
  7. I'v changed it to this: the website is the server // Opens a connection to a MySQL server $connection=mysql_connect ("mysql10.000webhost.com", $username, $password); if (!$connection) { die('Not connected : ' . mysql_error()); } But it still comes up with this error: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'a2221438'@'10.1.1.33' (using password: NO) in /home/a2221438/public_html/map.php on line 44 Free Web Hosting Not connected :
  8. This is the mstr_ref2.php <?php define('__HOST', ''); //localhost = database host name (normaly this won't need changing) define('__USER', ''); //xxx = database username define('__PASS', ''); //xxx = database password define('__DEF_DB', ''); //xxx = database name $con = mysql_connect(__HOST, __USER, __PASS) or die(mysql_error()); $db = mysql_select_db(__DEF_DB, $con) or die (mysql_error()); ?>
  9. for some reason my database will not connect, here's the code: <?php require("mstr_ref2.php"); function parseToXML($htmlStr) { $xmlStr=str_replace('<','<',$htmlStr); $xmlStr=str_replace('>','>',$xmlStr); $xmlStr=str_replace('"','"',$xmlStr); $xmlStr=str_replace("'",'&#39;',$xmlStr); $xmlStr=str_replace("&",'&',$xmlStr); return $xmlStr; } // Opens a connection to a MySQL server $connection=mysql_connect (localhost, $username, $password); if (!$connection) { die('Not connected : ' . mysql_error()); } // Set the active MySQL database $db_selected = mysql_select_db($database, $connection); if (!$db_selected) { die ('Can\'t use db : ' . mysql_error()); } // Select all the rows in the markers table $query = "SELECT * FROM markers WHERE 1"; $result = mysql_query($query); if (!$result) { die('Invalid query: ' . mysql_error()); } header("Content-type: text/xml"); // Start XML file, echo parent node echo '<markers>'; // Iterate through the rows, printing XML nodes for each while ($row = @mysql_fetch_assoc($result)){ // ADD TO XML DOCUMENT NODE echo '<marker '; echo 'name="' . parseToXML($row['name']) . '" '; echo 'address="' . parseToXML($row['address']) . '" '; echo 'lat="' . $row['lat'] . '" '; echo 'lng="' . $row['lng'] . '" '; echo 'type="' . $row['type'] . '" '; echo '/>'; } // End XML file echo '</markers>'; ?> I think there is something wrong with this line of code. Where it says 'locat host' im not too sure about that because im not connecting to a local host, so what can i put in there instead?i think that is the problem. $connection=mysql_connect (localhost, $username, $password); This is the error I get: Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'a2221438'@'localhost' (using password: NO) in /home/a2221438/public_html/map.php on line 44
  10. Heres the code from the results page: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Mumtaz Properties</title> <link rel="stylesheet" href="cutouts/style.css"/> </head> <body> <!--Main Div Tag--> <div id="wrapperinsert"> <div id="header"> <div id="logo"><a href="index.php"><img src="cutouts/Homepage/logo.png" alt=""/></a></div> </div> <div id="navigation"> <a id="Home" href="index.php" title="home"><span>home</span></a> <a id="Sale" href="forsale.html" title="for sale"><span>for sale</span></a> <a id="Rent" href="forrent.html" title="for rent"><span>for rent</span></a> <a id="Contact" href="contact.html" title="contact us"><span>contact us</span></a> </div> <div id="main"> <div id="results"><img src="cutouts/Homepage/results.png"></img></div> <?php require_once 'mstr_ref.php'; function san($input){ if(get_magic_quotes_gpc()){ $input=stripcslashes($input); } $output = mysql_real_escape_string($input); return $output; } if(isset($_POST['submit'])){ if((isset($_POST['min_price1']) && $_POST['min_price1'] != 0) || (isset($_POST['max_price1']) && $_POST['max_price1'] != 0)){ $_POST['min_price'] = $_POST['min_price1']; $_POST['max_price'] = $_POST['max_price1']; } elseif((isset($_POST['min_price2']) && $_POST['min_price2'] != 0) || (isset($_POST['max_price2']) && $_POST['max_price2'] != 0)){ $_POST['min_price'] = $_POST['min_price2']; $_POST['max_price'] = $_POST['max_price2']; } elseif((isset($_POST['min_price3']) && $_POST['min_price3'] != 0) || (isset($_POST['max_price3']) && $_POST['max_price3'] != 0)){ $_POST['min_price'] = $_POST['min_price3']; $_POST['max_price'] = $_POST['max_price3']; } $pVars = array('area'=>$_POST['areas'], 'propType'=>$_POST['prop_type'], 'saleType'=>$_POST['ptype'], 'minB'=>$_POST['min_bedrooms'], 'maxB'=>$_POST['max_bedrooms'], 'minP'=>$_POST['min_price'], 'maxP'=>$_POST['max_price']); foreach ($pVars as $k=>$v){ $v = san($v); } $sql = new makeQuery(); $sql->manAdd('location_id', $pVars['area']); if($pVars['propType'] != 'Any'){ $sql->manAdd('catagory_id', $pVars['propType']); } if ($pVars['maxB'] > 0){ $sql->manAdd('bedrooms', $pVars['maxB'], '<='); } if($pVars['minB'] > 0){ $sql->manAdd('bedrooms',$pVars['minB'],'>='); } if($pVars['saleType'] != 'Any'){ if($pVars['saleType'] == "forsale"){ $sql->manAdd('market_type', 'sale'); if($pVars['minP'] != 0){ // $pVars['minP'] = $pVars['minP'] * 1000; } if($pVars['maxP'] != 0){ // $pVars['maxP'] = $pVars['maxP'] * 1000; } } if($pVars['saleType'] == 'forrent'){ $sql->manAdd('market_type', 'rent'); } } if ($pVars['maxP'] > 0){ $sql->manAdd('asking_price', $pVars['maxP'], '<='); } if($pVars['minP'] > 0){ $sql->manAdd('asking_price',$pVars['minP'],'>='); } $qry = $sql->sqlStart.$sql->stmt.'Group By property.id'; $results = mysql_query($qry) or die (mysql_error()."<br />|-|-|-|-|-|-|-|-|-|-|-|-<br />$qry"); if(mysql_num_rows($results) < 1){ die ('<div class="error">Sorry, No Results Match Your Search.</div>'); } while($row = mysql_fetch_assoc($results)){ echo '<div class="container" style="float:left;">'; echo '<div class="imageholder" style="float:left;">'; echo "<a href='{$row['url']}'><img class='image1' src='{$row['image_path']}' alt='{$row['summary']}' /></a> <br />"; echo '</div>'; echo '<div class="textholder" style="font-family:helvetica; font-size:14px; float:left; padding-top:10px;">'; echo "{$row['summary']}"; echo "<span style=\"color:#63be21;\"><br><br><b>{$row['bedrooms']} bedroom(s) {$row['bathrooms']} bathroom(s) {$row['receptions']} reception room(s)</b></span>"; if($row['parking'] != null){ echo "<span style=\"color:#63be21;\"><b> {$row['parking']} parking space(s)</b></span>"; echo '<div class="sline"><img src="cutouts/search/sline.png" alt=""/></div>'; } echo '</div>'; echo '<div style="clear:both"></div>'; } } else{ echo "There was a problem, please click<a href='index.php'> Here </a>to return to the main page and try again"; } ?> </div> </div> </body> </html>
  11. this is the code for the search form: <?php $locationSql = "SELECT id, area_name FROM locations GROUP by area_name"; $locQry = mysql_query($locationSql) or die (mysql_error()); echo "<select name=\"areas\" size=\"5\" style=\"width:150px;\">"; while ($location = mysql_fetch_assoc($locQry)){ echo "<option value=\"{$location['id']}\">{$location['area_name']}</option>"; } echo "</select>"; ?> </div> </td><td><p class="PT">Property type:</p></td> <td><div id="PS"> <?php $catSql = "SELECT id, cat_name FROM catagorys GROUP by cat_name"; $catQry = mysql_query($catSql) or die (mysql_error()); echo "<select name=\"prop_type\" size\"=5\" style=\"width:150px;\">"; while ($cat = mysql_fetch_assoc($catQry)){ echo "<option value=\"{$cat['id']}\">{$cat['cat_name']}</option>"; } echo "</select>"; ?> </div> </td> <td> <div id="ptype"> <input type="radio" class="styled" name="ptype" value="forsale" onclick="Toggle('Div1');" /> For Sale <p class="increase"> <input type="radio" class="styled" name="ptype" value="forrent" onclick="Toggle('Div2');" /> To Rent </p> <p class="increase"> <input type="radio" class="styled" name="ptype" value="any" onclick="Toggle('Div3');" /> Any </p> </div> </td> </tr> </table> <div id="table2"> <table id="NBtable"> <tr> <td><p class="NBS">Number of bedrooms:</p></td> <td><div id="NB"> <select name="min_bedrooms"> <?php $roomLimit = 5; for($minRooms = 0; $minRooms <= $roomLimit; $minRooms++){ if ($minRooms == 0){ echo"<option value=\"0\" selected=\"selected\">No Min</option>"; } else{ echo "<option value=\"$minRooms\">$minRooms</option>"; } } ?> </select> to <select name="max_bedrooms"> <?php $roomLimit = 5; for($maxRooms = 0; $maxRooms <= $roomLimit; $maxRooms++){ if ($maxRooms == 0){ echo"<option value=\"0\" selected=\"selected\">No Max</option>"; } else{ echo "<option value=\"$maxRooms\">$maxRooms</option>"; } } ?>
  12. drummin the code you posted, what does that do,does it get data from the database?
  13. Thanks so much for your help, i really not sure which is the best way to set it up? but Im planning to have a mysql table with the images which are links and have them display depending on the type of house it is. and yeah I need to change the page to php. This is the full HTML code for the page where I want the filter: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Mumtaz Properties</title> <link rel="stylesheet" href="cutouts/style.css"/> </head> <body> <!--Main Div Tag--> <div id="wrapper"> <div id="header"> <div id="logo"><a href="index.php"><img src="cutouts/Homepage/logo.png" alt=""/></a></div> </div> <div id="navigation"> <a id="Home" href="index.php" title="home"><span>home</span></a> <a id="Sale" href="forsale.html" title="for sale"><span>for sale</span></a> <a id="Rent" href="forrent.html" title="for rent"><span>for rent</span></a> <a id="Contact" href="contact.html" title="contact us"><span>contact us</span></a> </div> <div id="main"> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td><div id="filter"><p class="houses" style="font-family:helvetica;color:#0155a1;font-size:14px;background:url(cutouts/forsale/filter.jpg) no-repeat;"><b><u>All</u></b> <br /> <span class="dh"><b><u>Detached Houses</u></b></span> <br /> <span class="dh"><b><u>Semi-detached houses</u></b></span> <br /> <span class="dh"><b><u>Terraced houses</u></b></span> <br /> <br /> <b><u>Flats / Apartments</u></b> </p></div></td> <td><div id="info1"><a href="property 2.html"><img src="cutouts/forsale/pinfo1.jpg" alt=""/></a></div></td> </tr> </table> <div id="info2"><a href="property 3.html"><img src="cutouts/forsale/pinfo2.jpg" alt=""/></a></div> <div id="info3"><a href="property 4.html"><img src="cutouts/forsale/pinfo3.jpg" alt=""/></a></div> </div> <div id="footer"> <a id="fHome" href="index.php" title="homepage"><span>homepage</span></a> <a id="fSale" href="forsale.html" title="for sale"><span>for sale</span></a> <a id="fRent" href="forrent.html" title="for rent"><span>for rent</span></a> <a id="fContact" href="contact.html" title="contact us"><span>contact us</span></a> </div> </div> </body> </html> These are the images that I want them to be displayed correctly when selecting the type of properties (<div id="info 1">"info2" and "info3" the code is just taken from the above post </p></div></td> <td><div id="info1"><a href="property 2.html"><img src="cutouts/forsale/pinfo1.jpg" alt=""/></a></div></td> </tr> </table> <div id="info2"><a href="property 3.html"><img src="cutouts/forsale/pinfo2.jpg" alt=""/></a></div> <div id="info3"><a href="property 4.html"><img src="cutouts/forsale/pinfo3.jpg" alt=""/></a></div> </div>
  14. I basically have a website and want users to be able to filter the results for examples when accessing the property website all the properties will be displayed, but on the left hand side I have filters, So i when a user click 'semi detached' then only semi detach properties appear, when the user click 'detached' then only detached properties will appear. Do i do this with a array filter? Help would be really appreciated, thanks.
  15. Basically, if you check this page out: http://www.mumtazproperties.hostei.com/forsale.html It shows all my images which are links to pages, what I want it for them images to show depending on what is selected e.g. 'semi detached' then only the semi detached properties will show(that is a image). So first I need to set my mySQL table with the different types e.g. 'All' 'detached' 'semi-detached' 'terrace' and then add the directory of the images? Any help is appreciated.
  16. Thanks mate,il try that, where does the closing php tag go?
  17. How do i grab the current post values and save these to session from my mySQL Database?
  18. thanks loser34370(im sure ur not a loser) lol and yeah drummin, its been a long road with php. could you possibly break it down for me mate, iv not started on anything for these filters yet.
  19. ahh ok thank you for that information.
  20. Yeah, thats brilliant thank you very much.
  21. I would like to style this echo in my css, how would I go about making it a div class or something to give it a ID. die ("Sorry, No Results Match Your Search."); Thank You
  22. HTML Code: <table border="0" cellpadding="0" cellspacing="0"> <tr> <td><div id="filter"><p class="houses" style="font-family:helvetica;color:#0155a1;font-size:14px;background:url(cutouts/forsale/filter.jpg) no-repeat;"><b><u>All</u></b> <br /> <a href="www.mumtazproperties.hostei.com/show_houses.php?type=detached"><span class="dh"><b><u>Detached Houses</u></b></span></a> <br /> <span class="dh"><b><u>Semi-detached houses</u></b></span> <br /> <span class="dh"><b><u>Terraced houses</u></b></span> <br /> <br /> <b><u>Flats / Apartments</u></b> </p></div></td> <td><div id="info1"><a href="property 2.html"><img src="cutouts/forsale/pinfo1.jpg" alt=""/></a></div></td> </tr> </table>
  23. I have a property website and I want users to be able to filter the properties, So when they access the page, and click 'detached properties' only detached properties will appear, if the user selects 'semi-detached' then only semi detached properties will appear. I already have a mySQL database set up. Image attached here to have a better understanding.
  24. I dont understand the detail.php, because what i want is when users make a search using the form,and results come up of properties, I want them to be able to click the image of a property and that will directly take them to another page with more information of that property that they selected. (The pages of ALL properties are already in the same directory. and they are .html pages)
  25. The above post is the error i'm receiving on the 'detail.php'. Thank you so much with the price range,just checked it and works. Thats absolutely amazing! Thanks so much!
×
×
  • 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.