Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <HTML>
- <?php
- $maxprice = $_REQUEST["maxprice"];
- $minprice = $_REQUEST["minprice"];
- $beds = $_REQUEST["beds"]
- //setup the variables for accessing the database
- $server = "ephesus";
- $username = "scm9hab";
- $password = "koleft";
- $database = "db10x9hab";
- //connect to the database server
- $connection = mysql_connect($server, $username, $password);
- //specify the database that we want to access
- mysql_select_db($database);
- //build a database query
- $query = "SELECT * FROM Properties WHERE Beds >= $beds AND Price <= $maxprice AND Price >= $minprice";
- //execute the query and get the results back from the database
- $results = mysql_query($query);
- ?>
- <TABLE border=1>
- <TR><TD>PropertyID</TD><TD>Address</TD><TD>Price</TD><TD>Image</TD></TR>
- <?php
- //loop through the results in turn (assigning each to $row)
- while ($row = mysql_fetch_row($results))
- {
- //get the individual fields from this row
- $id = $row[0];
- $address= $row[1];
- $price = $row[2];
- $image = $row[3];
- //print the field data to the browser
- print "<TR><TD>$id</TD><TD>$address</TD><TD>$price</TD><TD><IMG SRC='images/properties/$image' height='30' width='30'/></TD><TR>";
- }
- mysql_close($connection);
- ?>
- </TABLE>
- </HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement