Solved

Return Multiple records from mysql database using php

Posted on 2009-03-30
2
579 Views
Last Modified: 2012-05-07
Hi

I have a database which has reviews for accommodation on it, the problem i have is when two different people register the same address. The database excepts both input, but when you then search the database, it only comes back with the one record.

What i need some help with is code which if multiple records are returned then each one is put under a text link saying (review 1, review 2) for example, which when clicked will bring up the info stored in the database  . But when there is only one record then that record is shown straight away.

I tried to do some work on querying the database for multple record but cannot get it to work. (im new to databases)

Any help would be great and if you need any more info please ask. Ill post the code for the registration of the address and then the code for the searching of the database

cheers
Register Address:

 

 

<!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" xml:lang="en" lang="en">

<head>

    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

    <title>RateStudentSpace - Register</title>

    <style type="text/css" media="all">

        @import "layout1.css";

      body {

  background-color: #ccccff;

	} 

 	

		 div.c2 {clear:both;}

 		div.c1 {clear: both;}

		

	img {border-style: none;}

	

	#wrap

        {

            max-width: 900px;

            min-width: 700px;

            width: 90%;

            margin: 20% auto;

            height: 100%;

        }

        #main

        {

            background-image: url('images/contents.jpg');

            width: 809px;

            height: 1480px;

            margin-left: 3%;

            position: absolute;

			top:225px;

        }

		

		#main_long

        {

            background-image: url('images/contents.jpg');

            width: 809px;

            height: 1830px;

            margin-left: 3%;

            position: absolute;

			top:225px;

        }

		

        .info

        {

            margin-top: 10px;

			margin-bottom: 2em;

            margin-right: 2em;

            margin-left: 2em;

            font: 13px "Lucida Sans Unicode" , Verdana, sans-serif;

		 }

		

		.err

		{

			margin-top: 10px;

			margin-bottom: 10px;

			margin-right: 10px;

			margin-left: 10px;

			font: 13px "Lucida Sans Unicode" , Verdana, sans-serif;

		}

 

			

			

		#login

			{

			background-image: url('images/login.jpg');

			width: 67px;

			height: 53px;

			font: 13px "Lucida Sans Unicode" , Verdana, sans-serif;

			margin-left: 100%;

			margin-top: 220px;

			}

			

		.reg

		{

			margin-top: 9px;

			margin-bttom: 1em;

			margin-right: 1em;

			margin-left: 9px;

			font: 11px "Lucida Sans Unicode" , Verdana, sans-serif;

		}

 

		

	

		

        #header

        {

            background-image: url('images/header.jpg');

			background-repeat:no-repeat;

            width: 809px;

            height: 191px;

            position: absolute;

            top: 0%;

            margin-left: 3%;

        }

        #home

        {

            width: 115px;

            height: 34px;

            position: absolute;

            margin-left: 0%;

            margin-top: 190px;

        }

        #leave

        {

            width: 115px;

            height: 34px;

            position: absolute;

            margin-left: 28%;

            margin-top: 190px;

        }

        #search

        {

            width: 115px;

            height: 34px;

            position: absolute;

            margin-left: 58%;

            margin-top: 190px;

        }

        #help

        {

            width: 115px;

            height: 34px;

            position: absolute;

            margin-left: 85.9%;

            margin-top: 190px;

        }

		

		.info h2 {

	font-size: 100%;

	font: 18px "Lucida Sans Unicode" , Verdana, sans-serif;

	text-align: center;

	padding: 0;}

	

	.info h3 {

		font-size:100%;

			font: 10px "Lucida Sans Unicode" , Verdana, sans-serif;

		text-align: left;

		padding:0;

			}

			

			.info h4 {

		font-size:100%;

			font: 18px "Lucida Sans Unicode" , Verdana, sans-serif;

		text-align: left;

		padding:0;

			}

			

		#indent

				{

				margin-left: 12%;

				font: 13px "Lucida Sans Unicode" , Verdana, sans-serif;

					

				}

 

				

    </style>

</head>

<body>

    <div id="wrap">

        <!-- Goes with the CSS layout. -->

        <!-- Script 7.1 - header.html -->

        <!-- Start of page-specific content. -->

        <body bgcolor="#ccccff">

            <div id="header">

<div id="home"><a href="index.html"><img src="images/home.jpg" width="115" height="34" alt="home" /></a></div>

<div class="c1"></div>

<div id="leave"><a href="register.php"><img src="images/leave.jpg" width="115" height="34" alt="leave" /></a></div>

<div class="c1"></div>

<div id="help"><a href="help.html"><img src="images/help.jpg" width="115" height="34" alt="help" /></a></div>

<div class="c1"></div>

<div id="search"><a href="search.php"><img src="images/search.jpg" width="115" height="34" alt="search" /></a></div>

<div class="c1"></div>

<div id="login"><div class="reg"><p><br /><a href="register.php"><strong>Register</strong></a><br /><a href="login.php"><strong>Login</strong></a></p></div></div>					

<div class="c1"></div>			

</div>					

 

				

				

				

				

				

 

 

<?php # Script 7.7 - register.php (3rd version after Scripts 7.3 & 7.5)

 

$page_title = 'Register';

 

 

// Check if the form has been submitted.

if (isset($_POST['submitted'])) {

 

	require_once ('mysqlConnection.php'); // Connect to the db.

		

	// Create a function for escaping the data.

	function escape_data ($data) {

		global $dbc; // Need the connection.

		if (ini_get('magic_quotes_gpc')) {

			$data = stripslashes($data);

		}

return mysql_real_escape_string(trim($data));

	} // End of function.

 

	$errors = array(); // Initialize error array.

	

	// Check for a first number.

	if (empty($_POST['number'])) {

		$errors[] = 'You forgot to enter your house/flat number.';

	} else {

		$n = escape_data($_POST['number']);

	}

	

	// Check for a firstline.

	if (empty($_POST['firstline'])) {

		$errors[] = 'You forgot to enter the first line of your address.';

	} else {

		$fl = escape_data($_POST['firstline']);

	}

	

	// Check for an secondline.

	if (empty($_POST['secondline'])) {

		$sl = escape_data($_POST['secondline']);

	} else {

		$sl = escape_data($_POST['secondline']);

	}

	

	if (empty($_POST['city'])) {

		$errors[] = 'You forgot to enter the city.';

	} else {

		$c = escape_data($_POST['city']);

	}

	

	if (empty($_POST['county'])) {

		$co = escape_data($_POST['county']);

	} else {

		$co = escape_data($_POST['county']);

	}

	

	if (empty($_POST['postcode'])) {

		$pc = escape_data($_POST['postcode']);

	} else {

		$pc = escape_data($_POST['postcode']);

	}

	

	$year=$_POST['year'];

 

	

	//included in rent check box button validation

	  if(empty($_POST["water"])){

           $water="";

      }else{

      $water = trim($_POST["water"]);

      }

     

      if(empty($_POST["gas"])){

        $gas="";

      }else{

      $gas = trim($_POST["gas"]);

      }

 

	if(empty($_POST["electric"])){

           $electric="";

      }else{

      $electric = trim($_POST["electric"]);

      }

     

      if(empty($_POST["internet"])){

        $internet="";

      }else{

      $internet = trim($_POST["internet"]);

      }

	

	if(empty($_POST["skycable"])){

           $skycable="";

      }else{

      $skycable = trim($_POST["skycable"]);

      }

     

      if(empty($_POST["cleaning"])){

        $cleaning="";

      }else{

      $cleaning = trim($_POST["cleaning"]);

      }

	

	//facilites avaliable

	if(empty($_POST["furniture"])){

           $furniture="";

      }else{

      $furniture = trim($_POST["furniture"]);

      }

     

      if(empty($_POST["washmachine"])){

    		$washmachine="";

      }else{

      $washmachine = trim($_POST["washmachine"]);

      }

 

	if(empty($_POST["dryer"])){

           $dryer="";

      }else{

      $dryer = trim($_POST["dryer"]);

      }

     

      if(empty($_POST["cooker"])){

        $cooker="";

      }else{

      $cooker = trim($_POST["cooker"]);

      }

	

	if(empty($_POST["fridge"])){

           $fridge="";

      }else{

      $fridge = trim($_POST["fridge"]);

      }

     

      if(empty($_POST["doubleglazing"])){

        $doubleglazing="";

      }else{

      $doubleglazing = trim($_POST["doubleglazing"]);

      }

	

	if(empty($_POST["heating"])){

           $heating="";

      }else{

      $heating = trim($_POST["heating"]);

      }

     

      if(empty($_POST["alarm"])){

        $alarm="";

      }else{

      $alarm = trim($_POST["alarm"]);

      }

 

	if(empty($_POST["firealarm"])){

           $firealarm="";

      }else{

      $firealarm = trim($_POST["firealarm"]);

      }

     

      if(empty($_POST["locks"])){

        $locks="";

      }else{

      $locks = trim($_POST["locks"]);

      }

	

	if(empty($_POST["parking"])){

           $parking="";

      }else{

      $parking = trim($_POST["parking"]);

      }

     

      if(empty($_POST["entrance"])){

        $entrance="";

      }else{

      $entrance = trim($_POST["entrance"]);

      }

	

	if(empty($_POST["commonroom"])){

        $commonroom="";

      }else{

      $commonroom = trim($_POST["commonroom"]);

      }

	

	if(empty($_POST["bath"])){

           $bath="";

      }else{

      $bath = trim($_POST["bath"]);

      }

     

      if(empty($_POST["shower"])){

        $shower="";

      }else{

      $shower = trim($_POST["shower"]);

      }

	

	//beds

	if (empty($_POST['beds'])) {

		$beds = escape_data($_POST['beds']);

	} else {

		$beds = escape_data($_POST['beds']);

	}

	

	if (empty($_POST['dbeds'])) {

		$dbeds = escape_data($_POST['dbeds']);

	} else {

		$dbeds = escape_data($_POST['dbeds']);

	}

	

	

	//rent validation

	if (empty($_POST['rent'])) {

		$re = escape_data($_POST['rent']);

	} else {

		$re = escape_data($_POST['rent']);

	}

	

	//rent paid validation

	$rentpaid=$_POST['rentpaid']; 

	

	//distance to uni

	$distanceuni=$_POST['distanceuni'];

	$distanceshop=$_POST['distanceshop'];

	$noise=$_POST['noise'];

	$safety=$_POST['safety'];

	$fandf=$_POST['fandf'];	

	$community=$_POST['community'];

	

	//landlord estate agent

	$polite=$_POST['polite'];

	$flexability=$_POST['flexability'];

	$contact=$_POST['contact'];

	$jobdone=$_POST['jobdone'];

	

	if (empty($_POST['comments'])) {

		$comments = escape_data($_POST['comments']);

	} else {

		$comments = escape_data($_POST['comments']);

	}

	

	

 	

	

	

	// Check for a password and match against the confirmed password.

	//if (!empty($_POST['password1'])) {

		//if ($_POST['password1'] != $_POST['password2']) {

			//$errors[] = 'Your password did not match the confirmed password.';

		//} else {

			//$p = escape_data($_POST['password1']);

		//}

	//} else {

		//$errors[] = 'You forgot to enter your password.';

	//}

	

	if (empty($errors)) { // If everything's okay.

	

		// Register the user in the database.

		

		// Check for previous registration.

		//$query = "SELECT user_id FROM users WHERE email='$e'";

		//$result = mysql_query($query);

		//if (mysql_num_rows($result) == 0) {

 

		

			// Make the query.

			$query = "INSERT INTO address (number, firstline, secondline, city, county, postcode, year, water, gas, electric, internet, skycable, cleaning, rent, rentpaid, furniture, washmachine, dryer, cooker, fridge, doubleglazing, heating, alarm, firealarm, locks, parking, entrance, commonroom, bath, shower, beds, dbeds, distanceuni, distanceshop, noise, safety, fandf, community, polite, flexability, contact, jobdone, comments) 

			VALUES ('$n', '$fl', '$sl', '$c', '$co', '$pc', '$year',  '$water', '$gas', '$electric', '$internet', '$skycable', '$cleaning', '$re', '$rentpaid', '$furniture', '$washmachine', '$dryer', '$cooker', '$fridge', '$doubleglazing', '$heating', '$alarm', '$firealarm', '$locks', '$parking', '$entrance', '$commonroom', '$bath', '$shower', '$beds', '$dbeds', '$distanceuni', '$distanceshop', '$noise', '$safety', '$fandf', '$community', '$polite', '$flexability', '$contact', '$jobdone', '$comments')";		

			$result = @mysql_query ($query); // Run the query.

			if ($result) { // If it ran OK.

			

				// Send an email, if desired.

				

				// Print a message.

				echo '<div id="main"><div class="info"><<h1 id="mainhead">Thank you!</h1>

			<p>Thank you for reviewing your student accommdation.</p><p><br /></p></div></div>';	

			

				// Include the footer and quit the script (to not show the form).

				include ('footer.html'); 

				exit();

				

			} else { // If it did not run OK.

				echo '<div id="main"><div class="info"><h1 id="mainhead">System Error</h1>

				<p class="error">You could not be registered due to a system error. We apologize for any inconvenience.</p></div></div>'; // Public message.

				echo '<p>' . mysql_error() . '<br /><br />Query: ' . $query . '</p>'; // Debugging message.

				include ('footer.html'); 

				exit();

			}

				

		//} else { // Already registered.

			//echo '<h1 id="mainhead">Error!</h1>

			//<p class="error">The email address has already been registered.</p>';

		//}

		

	} else { // Report the errors.

	

		echo '<div id="main"><div class="info"><h1 id="mainhead">Error!</h1>

		<p class="error">The following error(s) occurred:<br />';

		foreach ($errors as $msg) { // Print each error.

			echo " - $msg<br />\n";

			

		}

		echo '</p><p><a href="register.php">Please try again</a></p><p><br /></p></div></div>';

		

		include ('footer.html'); 

				exit();

	} // End of if (empty($errors)) IF.

 

	//mysql_close(); // Close the database connection.

		

} // End of the main Submit conditional.

?>

				

				

				

				

				

				

            <div id="main">

                <div class="info">

                    <h2><b>Register House/Flat/Halls</b></h2>

                        

                    <form action="register.php" method="post">

                    <div>

                        <b>ACCOMMODATION INFORMATION</b></div>

                    <div><br/>

                        <div style="width: 80px; float: left;">

                            Number:</div>

                        <div style="float: left; width: auto;">

                            <input type="text" name="number" size="20" maxlength="15" value="<?php if (isset($_POST['number'])) echo $_POST['number']; ?>" /></div>

                        <div style="clear: both;">

                        </div>

                        <div style="width: 80px; float: left;">

                            First Line:</div>

                        <div style="float: left; width: auto;">

                            <input type="text" name="firstline" size="20" maxlength="30" value="<?php if (isset($_POST['firstline'])) echo $_POST['firstline']; ?>" /></div>

                        <div style="clear: both;">

                        </div>

                        <div style="width: 80px; float: left;">

                            Second Line:</div>

                        <div style="float: left; width: auto;">

                            <input type="text" name="secondline" size="20" maxlength="40" value="<?php if (isset($_POST['secondline'])) echo $_POST['secondline']; ?>" /></div>

                        <div style="clear: both;">

                        </div>

                        <div style="width: 80px; float: left;">

                            City:</div>

                        <div style="float: left; width: auto;">

                            <input type="text" name="city" size="20" maxlength="20" value="<?php if (isset($_POST['city'])) echo $_POST['city']; ?>" /></div>

                        <div style="clear: both;">

                        </div>

                        <div style="width: 80px; float: left;">

                            County:</div>

                        <div style="float: left; width: auto;">

                            <input type="text" name="county" size="20" maxlength="20" value="<?php if (isset($_POST['county'])) echo $_POST['county']; ?>" /></div>

                        <div style="clear: both;">

                        </div>

                        <div style="width: 80px; float: left;">

                            Postcode:</div>

                        <div style="float: left; width: auto;">

                            <input type="text" name="postcode" size="20" maxlength="20" value="<?php if (isset($_POST['postcode'])) echo $_POST['postcode']; ?>" /></div>

						    <div style="clear: both;">

								</div>		

						 <div style="width: 80px; float: left;">

                            Year:</div>

                        <div style="float: left; width: auto;">

                        <select name="year" id="year"></div>

                        <option value="08-09">2008-2009</option>

                        <option value="07-08">2007-2008 </option>

                        <option value="06-08">2006-2007</option>

						</select>

									

						<div style="clear: both;">

                        </div>

						<br /></div>

                    <div style="clear: both;">

                    </div>

                    <div>

                        <div>

                           

                             <br /><b>Please tick which items are included in the rent.</b><br />

                        </div>

                        <div>

                            <input type="checkbox" name="water" value="water" />Water </input></div>

                        <div>

                            <input type="checkbox" name="gas" value="gas" />Gas </input></div>

                        <div>

                            <input type="checkbox" name="electric" value="electric" />Electric </input></div>

                        <div>

                            <input type="checkbox" name="internet" value="internet" />Internet </input></div>

                        <div>

                            <input type="checkbox" name="skycable" value="skycable" />Sky/Cable </input></div>

                        <div>

                            <input type="checkbox" name="cleaning" value="cleaning" />Cleaning </input></div>

                    </div>

                    <div style="clear: both;">

                    </div>

                    <div>

                        <div>

                            <br />

                            <b>Please tick which facilities are avaliable to the occupier.</b><br />

                        </div>

                        <div><br/>

                            <input type="checkbox" name="furniture" value="furniture">Furniture </input><br />

                        </div>

                        <div>

                            <input type="checkbox" title="amar" name="washmachine" value="washmachine">Washing Mashine

                            </input>

                        </div>

                        <div>

                            <input type="checkbox" name="dryer" value="dryer">Dryer </input>

                        </div>

                        <div>

                            <input type="checkbox" name="cooker" value="cooker">Cooker/Hob </input>

                        </div>

                        <div>

                            <input type="checkbox" name="fridge" value="fridge">Fridge Freezer </input>

                        </div>

                        <div>

                            <input type="checkbox" name="doubleglazing" value="doubleglazing">Double Glazing</input>

                        </div>

                    </div>

                    <div style="clear: both;">

                    </div>

                    <div>

                        <div>

                            <input type="checkbox" name="heating" value="heating">Central Heating </input>

                        </div>

                        <div>

                            <input type="checkbox" name="alarm" value="alarm">Burglar Alarm </input>

                        </div>

                        <div>

                            <input type="checkbox" name="firealarm" value="firealarm">Fire Alarm </input>

                        </div>

                        <div>

                            <input type="checkbox" name="locks" value="locks">Locks on room doors </input>

                        </div>

                        <div>

                            <input type="checkbox" name="parking" value="parking">Off street parking </input>

                        </div>

                        <div>

                            <input type="checkbox" name="entrance" value="entrance">Buzz/Security door entrance

                            </input>

                        </div>

                    </div>

                    <div style="clear: both;">

                    </div>

                    <div>

                        <div>

                            <input type="checkbox" name="commonroon" value="commonroom">Communal living space (e.sg

                                living room) </input>

                        </div>

                        <div>

                            <input type="checkbox" name="bath" value="bath">Bath</input></div>

                        <div>

                            <input type="checkbox" name="shower" value="shower">Shower</input></div>

                        <div>

                        </div>

                        <div style="clear: both;">

                        </div>

                        <br />

                        <div>

                            How many bedrooms:

                            <input type="text" name="beds" size="1" maxlength="1" value="<?php if (isset($_POST['beds'])) echo $_POST['beds']; ?>"><br />

                        </div>

                        <div style="clear: both;">

                        </div>

                        <div>

                            Of those how many are double rooms:

                            <input type="text" name="dbeds" size="1" maxlength="1" value="<?php if (isset($_POST['dbeds'])) echo $_POST['dbeds']; ?>">

                        </div>

                        <div style="clear: both;">

                        </div>

                        <div>

                            <br />

                            How much rent do you pay: £

                            <input type="text" name="rent" size="10" maxlength="20" value="<?php if (isset($_POST['rent'])) echo $_POST['rent']; ?>"><br />

                        </div>

                        <div style="clear: both;">

                        </div>

                        <div>

                            <br />

                            Is the rent paid:<select name="rentpaid" id="rentpaid"><br />

                        </div>

                        <div style="clear: both;">

                        </div>

                        <option value="weekly">Weekley</option>

                        <---- option 1

                        <option value="monthly">Monthly </option>

                        <---- option 2 </select>

                        <div>

                            <br />

                            <b>Please give a rating out of 5 for each of the following criteria (5 being the best):</b><br />

                        </div>

                        <div style="clear: both;">

                        </div>

                        <div><br/>

                            Distance to university:<select name="distanceuni" id="distanceuni"><br /></div>

                        <option value="1">1</option>

                        <option value="2">2 </option>

                        <option value="3">3</option>

                        <option value="4">4 </option>

                        <option value="5">5 </option>

                        </select><div style="clear: both;">

                        </div>

                        <div>

                            Distance to local shops:<select name="distanceshop" id="distanceshop"></div>

                        <option value="1">1</option>

                        <option value="2">2 </option>

                        <option value="3">3</option>

                        <option value="4">4 </option>

                        <option value="5">5 </option>

                        </select><div style="clear: both;">

                        </div>

                        <div>

                            Noise:<select name="noise" id="noise"></div>

                        <option value="1">1</option>

                        <option value="2">2 </option>

                        <option value="3">3</option>

                        <option value="4">4 </option>

                        <option value="5">5 </option>

                        </select><div style="clear: both;">

                        </div>

                        <div>

                            Safety:<select name="safety" id="safety"></div>

                        <option value="1">1</option>

                        <option value="2">2 </option>

                        <option value="3">3</option>

                        <option value="4">4 </option>

                        <option value="5">5 </option>

                        </select><div style="clear: both;">

                        </div>

                        <div>

                            Furniture and Fittings:<select name="fandf" id="fandf"></div>

                        <option value="1">1</option>

                        <option value="2">2 </option>

                        <option value="3">3</option>

                        <option value="4">4 </option>

                        <option value="5">5 </option>

                        </select><div style="clear: both;">

                        </div>

                        <div>

                            Community:<select name="community" id="community"></div>

                        <option value="1">1</option>

                        <option value="2">2 </option>

                        <option value="3">3</option>

                        <option value="4">4 </option>

                        <option value="5">5 </option>

                        </select><div style="clear: both;">

                        </div>

                        <div>

                            <br />

                            <b>LANDLORD/ESTATE AGENT INFORMATION</b><br />

                        </div>

                        <div><br/>

                            Politeness:<select name="polite" id="polite"><br /></div>

                        <option value="1">1</option>

                        <option value="2">2 </option>

                        <option value="3">3</option>

                        <option value="4">4 </option>

                        <option value="5">5 </option>

                        </select><div style="clear: both;">

                        </div>

                        <div>

                            Flexability:<select name="flexability" id="flexability"></div>

                        <option value="1">1</option>

                        <option value="2">2 </option>

                        <option value="3">3</option>

                        <option value="4">4 </option>

                        <option value="5">5 </option>

                        </select><div style="clear: both;">

                        </div>

                        <div>

                            Easy To Contact?:<select name="contact" id="contact"></div>

                        <option value="1">1</option>

                        <option value="2">2 </option>

                        <option value="3">3</option>

                        <option value="4">4 </option>

                        <option value="5">5 </option>

                        </select><div style="clear: both;">

                        </div>

                        <div>

                            Getting Jobs Done:<select name="jobdone" id="jobdone"></div>

                        <option value="1">1</option>

                        <option value="2">2 </option>

                        <option value="3">3</option>

                        <option value="4">4 </option>

                        <option value="5">5 </option>

                        </select>

                        <div><br/>

                            <b>Comments or information you feel is important to pass on :</b>

                            <textarea rows="5" cols="60" name="comments" size="50" maxlength="50" value="<?php if (isset($_POST['comments'])) echo $_POST['comments']; ?>"> </textarea><br /></div>

                        <div style="clear: both;">

                        </div>

                        <div>

                            <br />

                            <b>Please hit the submit button when finished.</b><br />

                        </div>

                        <div style="clear: both;">

                        </div>

                        <div><br/>

                            <input type="submit" name="submit" value="Submit" /><br /></div>

                        <div style="clear: both;">

                        </div>

                        <input type="hidden" name="submitted" value="TRUE" />

                    </form>

                    <!-- End of page-specific content. -->

                    <!-- Script 3.3 - footer.html -->

                </div>

            </div>

    </div>

 

    <div style="clear: both;">

    </div>

    <!-- End of "wrapper" DIV. -->

</body>

</html>

 

 

 

Search For Address:

 

 

<!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" xml:lang="en" lang="en">

<head>

    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />

    <title>RateStudentSpace - Register</title>

    <style type="text/css" media="all">

        @import "layout1.css";

      body {

  background-color: #ccccff;

	} 

 	

		 div.c2 {clear:both;}

 		div.c1 {clear: both;}

		

	img {border-style: none;}

	

	#wrap

        {

            max-width: 900px;

            min-width: 700px;

            width: 90%;

            margin: 20% auto;

            height: 100%;

        }

        #main

        {

            background-image: url('images/contents.jpg');

            width: 809px;

            height: 1480px;

            margin-left: 3%;

            position: absolute;

			top:225px;

        }

		

		#main_long

        {

            background-image: url('images/contents.jpg');

            width: 809px;

            height: 1830px;

            margin-left: 3%;

            position: absolute;

			top:225px;

        }

		

        .info

        {

            margin-top: 10px;

			margin-bottom: 2em;

            margin-right: 2em;

            margin-left: 2em;

            font: 13px "Lucida Sans Unicode" , Verdana, sans-serif;

		 }

		

		.err

		{

			margin-top: 10px;

			margin-bottom: 10px;

			margin-right: 10px;

			margin-left: 10px;

			font: 13px "Lucida Sans Unicode" , Verdana, sans-serif;

		}

 

			

			

		#login

			{

			background-image: url('images/login.jpg');

			width: 67px;

			height: 53px;

			font: 13px "Lucida Sans Unicode" , Verdana, sans-serif;

			margin-left: 100%;

			margin-top: 220px;

			}

			

		.reg

		{

			margin-top: 9px;

			margin-bttom: 1em;

			margin-right: 1em;

			margin-left: 9px;

			font: 11px "Lucida Sans Unicode" , Verdana, sans-serif;

		}

 

		

	

		

        #header

        {

            background-image: url('images/header.jpg');

			background-repeat:no-repeat;

            width: 809px;

            height: 191px;

            position: absolute;

            top: 0%;

            margin-left: 3%;

        }

        #home

        {

            width: 115px;

            height: 34px;

            position: absolute;

            margin-left: 0%;

            margin-top: 190px;

        }

        #leave

        {

            width: 115px;

            height: 34px;

            position: absolute;

            margin-left: 28%;

            margin-top: 190px;

        }

        #search

        {

            width: 115px;

            height: 34px;

            position: absolute;

            margin-left: 58%;

            margin-top: 190px;

        }

        #help

        {

            width: 115px;

            height: 34px;

            position: absolute;

            margin-left: 85.9%;

            margin-top: 190px;

        }

		

		.info h2 {

	font-size: 100%;

	font: 18px "Lucida Sans Unicode" , Verdana, sans-serif;

	text-align: center;

	padding: 0;}

	

	.info h3 {

		font-size:100%;

			font: 10px "Lucida Sans Unicode" , Verdana, sans-serif;

		text-align: left;

		padding:0;

			}

			

			.info h4 {

		font-size:100%;

			font: 18px "Lucida Sans Unicode" , Verdana, sans-serif;

		text-align: left;

		padding:0;

			}

			

		#indent

				{

				margin-left: 12%;

				font: 13px "Lucida Sans Unicode" , Verdana, sans-serif;

					

				}

 

				

    </style>

</head>

<body>

    <div id="wrap">

        <!-- Goes with the CSS layout. -->

        <!-- Script 7.1 - header.html -->

        <!-- Start of page-specific content. -->

        <body bgcolor="#ccccff">

            <div id="header">

<div id="home"><a href="index.html"><img src="images/home.jpg" width="115" height="34" alt="home" /></a></div>

<div class="c1"></div>

<div id="leave"><a href="register.php"><img src="images/leave.jpg" width="115" height="34" alt="leave" /></a></div>

<div class="c1"></div>

<div id="help"><a href="help.html"><img src="images/help.jpg" width="115" height="34" alt="help" /></a></div>

<div class="c1"></div>

<div id="search"><a href="search.php"><img src="images/search.jpg" width="115" height="34" alt="search" /></a></div>

<div class="c1"></div>

<div id="login"><div class="reg"><p><br /><a href="register.php"><strong>Register</strong></a><br /><a href="login.php"><strong>Login</strong></a></p></div></div>					

<div class="c1"></div>			

</div>		

		<!-- Script 7.1 - header.html -->

		<!-- Start of page-specific content. -->

 

<?php # Script 7.7 - register.php (3rd version after Scripts 7.3 & 7.5)

 

$page_title = 'Register';

 

 

// Check if the form has been submitted.

if (isset($_POST['submitted'])) {

 

	require_once ('mysqlConnection.php'); // Connect to the db.

		

	// Create a function for escaping the data.

	function escape_data ($data) {

		global $dbc; // Need the connection.

		if (ini_get('magic_quotes_gpc')) {

			$data = stripslashes($data);

		}

return mysql_real_escape_string(trim($data));

	} // End of function.

 

	$errors = array(); // Initialize error array.

	

	// Check for a first number.

	if (empty($_POST['number'])) {

		$errors[] = 'You forgot to enter your house/flat number.';

	} else {

		$n = escape_data($_POST['number']);

	}

	

	// Check for a firstline.

	if (empty($_POST['firstline'])) {

		$errors[] = 'You forgot to enter the first line of your address.';

	} else {

		$fl = escape_data($_POST['firstline']);

	}

	

	// Check for an secondline.

	if (empty($_POST['secondline'])) {

		$sl = escape_data($_POST['secondline']);

	} else {

		$sl = escape_data($_POST['secondline']);

	}

	

	if (empty($_POST['city'])) {

		$errors[] = 'You forgot to enter the city.';

	} else {

		$c = escape_data($_POST['city']);

	}

	

	if (empty($_POST['county'])) {

		$co = escape_data($_POST['county']);

	} else {

		$co = escape_data($_POST['county']);

	}

	

	if (empty($_POST['postcode'])) {

		$pc = escape_data($_POST['postcode']);

	} else {

		$pc = escape_data($_POST['postcode']);

	}

	

		if (empty($_POST['year'])) {

		$year = escape_data($_POST['year']);

	} else {

		$year = escape_data($_POST['year']);

	}

 

	

	

		

 	

	

	

	// Check for a password and match against the confirmed password.

	//if (!empty($_POST['password1'])) {

		//if ($_POST['password1'] != $_POST['password2']) {

			//$errors[] = 'Your password did not match the confirmed password.';

		//} else {

			//$p = escape_data($_POST['password1']);

		//}

	//} else {

		//$errors[] = 'You forgot to enter your password.';

	//}

	

	if (empty($errors)) { // If everything's okay.

	

		// Register the user in the database.

		

		// Check for previous registration.

		//$query = "SELECT user_id FROM users WHERE email='$e'";

		//$result = mysql_query($query);

		//if (mysql_num_rows($result) == 0) {

 

			// Make the query.

			$query = "SELECT * FROM address WHERE number = '$n' AND firstline = '$fl' AND city = '$c' AND year = '$year'";             

			$result = mysql_query ($query) or die( mysql_error() );

			

		if ($result > 0) { // If it ran OK, display the records.

 

	// EXECUTED THE QUERY ABOVE

 

// SEE IF THERE ARE RESULTS

if (!mysql_num_rows($result))  

{

   echo '<div id="main"><div class="info"><p>Sorry there is now review for that address.</p>

 

<p><a href="search.php">Please try again</a>, maybe select a different year.</p>

 

</div></div>';

include ('footer.html'); 

				exit();

}

else // THERE ARE RESULTS

{

 

// ITERATE OVER THE RESULT SET

   while ($row = mysql_fetch_assoc($result)) 

   { 

      extract($row); // GET LOCAL VARIABLES OUT OF ARRAY

      echo '<div id="main"><div class="info"><table>';

      echo "<tr colspan=\"2\"><td><b><br/>Address</b></td></tr>\n";

      echo "<tr><td><b>Number:</b></td><td>$number</td></tr>\n";

      echo "<tr><td><b>First Line:</b></td><td>$firstline</td></tr>\n";

	  echo "<tr><td><b>Second Line:</b></td><td>$secondline</td></tr>\n";

	  echo "<tr><td><b>City:</b></td><td>$c</td></tr>\n";

 

	  echo "<tr><td><b>Post Code:</b></td><td>$postcode</td></tr>\n";

	  echo "<tr><td><b>Year:</b></td><td>$year</td></tr>\n";

	

		echo "</table>\n";

		//results for utilities

		echo "<table>\n";

		echo"<br><p><b>Utilities included in rent.</b></p></br>";

		

		if ($water == '')

      {

         echo "<tr><td><b>Water:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Water:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($gas == '')

      {

         echo "<tr><td><b>Gas:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Gas:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($electric == '')

      {

         echo "<tr><td><b>Electric:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Electric:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($internet == '')

      {

         echo "<tr><td><b>Internet:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Internet:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($skycable == '')

      {

         echo "<tr><td><b>Sky/Cable:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Sky/Cable:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($cleaning == '')

      {

         echo "<tr><td><b>Cleaning:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Cleaning:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		echo "</table>\n";

		

		//result for facilities

		echo "<table>\n";

		

		echo"<br><p><b>Facilities avaliable to occupier.</b></p></br>";

		

		if ($furniture == '')

      {

         echo "<tr><td><b>Furniture:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Furniture:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($washmachine == '')

      {

         echo "<tr><td><b>Washing Machine:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Washing Machine:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($dryer == '')

      {

         echo "<tr><td><b>Dryer:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Dryer:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($cooker == '')

      {

         echo "<tr><td><b>Cooker:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Cooker:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

	

		if ($fridge == '')

      {

         echo "<tr><td><b>Fridge Freezer:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Fridge Freezer:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($doubleglazing == '')

      {

         echo "<tr><td><b>Double Glazing:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Double Glazing:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($heating == '')

      {

         echo "<tr><td><b>Central Heating:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Central Heating:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($alarm == '')

      {

         echo "<tr><td><b>Security Alarm:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Security Alarm:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($firealarm == '')

      {

         echo "<tr><td><b>Fire Alarm:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Fire Alarm:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($locks == '')

      {

         echo "<tr><td><b>Locks on doors:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Locks on doors:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($parking == '')

      {

         echo "<tr><td><b>Off street parking:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Off street parking:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($entrance == '')

      {

         echo "<tr><td><b>Secure/Buzz up entrance:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Secure/Buzz up entrance:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($commonroom == '')

      {

         echo "<tr><td><b>Commonroom/Lounge:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Commonroom/Lounge:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($bath == '')

      {

         echo "<tr><td><b>Bath:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Bath:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		if ($shower == '')

      {

         echo "<tr><td><b>Shower:</b></td><td><img alt=\"no\" src=\"images/unchecked.png\" /></td></tr>\n";

      } else {

         echo "<tr><td><b>Shower:</b></td><td><img alt=\"yes\" src=\"images/checked.png\" /></td></tr>\n";

      }

		

		echo "</table>\n";

		//beds

		echo "<table>\n";

		echo"<br><p><b>Bedrooms</b></p></br>";

 

		echo "<tr><td><b>Number of Bedrooms:</b></td><td>$beds</td></tr>\n";

		echo "<tr><td><b>Of which are double rooms:</b></td><td>$dbeds</td></tr>\n";

		echo "</table>\n";

		

		//rent

		echo "<table>\n";

		echo"<br><p><b>Rent</b></p></br>";

		echo "<tr><td><b>Rent Paid:</b></td><td>$rentpaid</td></tr>\n";

		echo "<tr><td><b>Rent:</b></td><td>$rent</td></tr>\n";

		echo "</table>\n";

	//areas rating

		echo "<table>\n";

		echo"<br><p><b>5 Star Rating of Accommodation and Location</b></p></br>";

 

		if ($distanceuni == '1')

		{

echo "<tr><td><b>Distance to university:</b></td><td><img alt=\"yes\" src=\"images/1star.png\" /></td></tr>\n";

		}

		if ($distanceuni == '2')

		{

echo "<tr><td><b>Distance to university:</b></td><td><img alt=\"yes\" src=\"images/2star.png\" /></td></tr>\n";

		}

		if ($distanceuni == '3')

		{

echo "<tr><td><b>Distance to university:</b></td><td><img alt=\"yes\" src=\"images/3star.png\" /></td></tr>\n";

		}		

		if ($distanceuni == '4')

		{

echo "<tr><td><b>Distance to university:</b></td><td><img alt=\"yes\" src=\"images/4star.png\" /></td></tr>\n";

		}

		if ($distanceuni == '5')

		{

echo "<tr><td><b>Distance to university:</b></td><td><img alt=\"yes\" src=\"images/5star.png\" /></td></tr>\n";

		}

		

		

		if ($distanceshop == '1')

		{

echo "<tr><td><b>Distance to local shop:</b></td><td><img alt=\"yes\" src=\"images/1star.png\" /></td></tr>\n";

		}

		if ($distanceshop == '2')

		{

echo "<tr><td><b>Distance to local shop:</b></td><td><img alt=\"yes\" src=\"images/2star.png\" /></td></tr>\n";

		}

		if ($distanceshop == '3')

		{

echo "<tr><td><b>Distance to local shop:</b></td><td><img alt=\"yes\" src=\"images/3star.png\" /></td></tr>\n";

		}		

		if ($distanceshop == '4')

		{

echo "<tr><td><b>Distance to local shop:</b></td><td><img alt=\"yes\" src=\"images/4star.png\" /></td></tr>\n";

		}

		if ($distanceshop == '5')

		{

echo "<tr><td><b>Distance to local shop:</b></td><td><img alt=\"yes\" src=\"images/5star.png\" /></td></tr>\n";

		}

		

		if ($noise == '1')

		{

echo "<tr><td><b>Noise Level:</b></td><td><img alt=\"yes\" src=\"images/1star.png\" /></td></tr>\n";

		}

		if ($noise == '2')

		{

echo "<tr><td><b>Noise Level:</b></td><td><img alt=\"yes\" src=\"images/2star.png\" /></td></tr>\n";

		}

		if ($noise == '3')

		{

echo "<tr><td><b>Noise Level:</b></td><td><img alt=\"yes\" src=\"images/3star.png\" /></td></tr>\n";

		}		

		if ($noise == '4')

		{

echo "<tr><td><b>Noise Level:</b></td><td><img alt=\"yes\" src=\"images/4star.png\" /></td></tr>\n";

		}

		if ($noise == '5')

		{

echo "<tr><td><b>Noise Level:</b></td><td><img alt=\"yes\" src=\"images/5star.png\" /></td></tr>\n";

		}

		

		if ($safety == '1')

		{

echo "<tr><td><b>Saftey:</b></td><td><img alt=\"yes\" src=\"images/1star.png\" /></td></tr>\n";

		}

		if ($safety == '2')

		{

echo "<tr><td><b>Safety:</b></td><td><img alt=\"yes\" src=\"images/2star.png\" /></td></tr>\n";

		}

		if ($safety == '3')

		{

echo "<tr><td><b>Safety:</b></td><td><img alt=\"yes\" src=\"images/3star.png\" /></td></tr>\n";

		}		

		if ($safety == '4')

		{

echo "<tr><td><b>Safety:</b></td><td><img alt=\"yes\" src=\"images/4star.png\" /></td></tr>\n";

		}

		if ($safety == '5')

		{

echo "<tr><td><b>Safety:</b></td><td><img alt=\"yes\" src=\"images/5star.png\" /></td></tr>\n";

		}

	

		if ($fandf == '1')

		{

echo "<tr><td><b>Furniture and Fittings:</b></td><td><img alt=\"yes\" src=\"images/1star.png\" /></td></tr>\n";

		}

		if ($fandf == '2')

		{

echo "<tr><td><b>Furniture and Fittings:</b></td><td><img alt=\"yes\" src=\"images/2star.png\" /></td></tr>\n";

		}

		if ($fandf == '3')

		{

echo "<tr><td><b>Furniture and Fittings:</b></td><td><img alt=\"yes\" src=\"images/3star.png\" /></td></tr>\n";

		}		

		if ($fandf == '4')

		{

echo "<tr><td><b>Furniture and Fittings:</b></td><td><img alt=\"yes\" src=\"images/4star.png\" /></td></tr>\n";

		}

		if ($fandf == '5')

		{

echo "<tr><td><b>Furniture and Fittings:</b></td><td><img alt=\"yes\" src=\"images/5star.png\" /></td></tr>\n";

		}

		

		if ($community == '1')

		{

echo "<tr><td><b>Sense of Community:</b></td><td><img alt=\"yes\" src=\"images/1star.png\" /></td></tr>\n";

		}

		if ($community == '2')

		{

echo "<tr><td><b>Sense of Community:</b></td><td><img alt=\"yes\" src=\"images/2star.png\" /></td></tr>\n";

		}

		if ($community == '3')

		{

echo "<tr><td><b>Sense of Community:</b></td><td><img alt=\"yes\" src=\"images/3star.png\" /></td></tr>\n";

		}		

		if ($community == '4')

		{

echo "<tr><td><b>Sense of Community:</b></td><td><img alt=\"yes\" src=\"images/4star.png\" /></td></tr>\n";

		}

		if ($community == '5')

		{

echo "<tr><td><b>Sense of Community:</b></td><td><img alt=\"yes\" src=\"images/5star.png\" /></td></tr>\n";

		}

		echo "</table>\n";

 

		echo "<table>\n";

		echo"<br><p><b>5 Star Rating for Estate Agent/Landlord</b></p></br>";

		

		if ($polite == '1')

		{

echo "<tr><td><b>Politeness:</b></td><td><img alt=\"yes\" src=\"images/1star.png\" /></td></tr>\n";

		}

		if ($polite == '2')

		{

echo "<tr><td><b>Politeness:</b></td><td><img alt=\"yes\" src=\"images/2star.png\" /></td></tr>\n";

		}

		if ($polite == '3')

		{

echo "<tr><td><b>Politeness:</b></td><td><img alt=\"yes\" src=\"images/3star.png\" /></td></tr>\n";

		}		

		if ($polite == '4')

		{

echo "<tr><td><b>Politeness:</b></td><td><img alt=\"yes\" src=\"images/4star.png\" /></td></tr>\n";

		}

		if ($polite == '5')

		{

echo "<tr><td><b>Politeness:</b></td><td><img alt=\"yes\" src=\"images/5star.png\" /></td></tr>\n";

		}

		

		if ($flexability == '1')

		{

echo "<tr><td><b>Flexability:</b></td><td><img alt=\"yes\" src=\"images/1star.png\" /></td></tr>\n";

		}

		if ($flexability == '2')

		{

echo "<tr><td><b>Flexability:</b></td><td><img alt=\"yes\" src=\"images/2star.png\" /></td></tr>\n";

		}

		if ($flexability == '3')

		{

echo "<tr><td><b>Flexability:</b></td><td><img alt=\"yes\" src=\"images/3star.png\" /></td></tr>\n";

		}		

		if ($flexability == '4')

		{

echo "<tr><td><b>Flexability:</b></td><td><img alt=\"yes\" src=\"images/4star.png\" /></td></tr>\n";

		}

		if ($flexability == '5')

		{

echo "<tr><td><b>Flexability:</b></td><td><img alt=\"yes\" src=\"images/5star.png\" /></td></tr>\n";

		}

		

		if ($contact == '1')

		{

echo "<tr><td><b>Contactability:</b></td><td><img alt=\"yes\" src=\"images/1star.png\" /></td></tr>\n";

		}

		if ($contact == '2')

		{

echo "<tr><td><b>Contactability:</b></td><td><img alt=\"yes\" src=\"images/2star.png\" /></td></tr>\n";

		}

		if ($contact == '3')

		{

echo "<tr><td><b>Contactability:</b></td><td><img alt=\"yes\" src=\"images/3star.png\" /></td></tr>\n";

		}		

		if ($contact == '4')

		{

echo "<tr><td><b>Contactability:</b></td><td><img alt=\"yes\" src=\"images/4star.png\" /></td></tr>\n";

		}

		if ($contact == '5')

		{

echo "<tr><td><b>Contactability:</b></td><td><img alt=\"yes\" src=\"images/5star.png\" /></td></tr>\n";

		}

		

		if ($jobdone == '1')

		{

echo "<tr><td><b>Completing requested tasks/jobs:</b></td><td><img alt=\"yes\" src=\"images/1star.png\" /></td></tr>\n";

		}

		if ($jobdone == '2')

		{

echo "<tr><td><b>Completing requested tasks/jobs:</b></td><td><img alt=\"yes\" src=\"images/2star.png\" /></td></tr>\n";

		}

		if ($jobdone == '3')

		{

echo "<tr><td><b>Completing requested tasks/jobs:</b></td><td><img alt=\"yes\" src=\"images/3star.png\" /></td></tr>\n";

		}		

		if ($jobdone == '4')

		{

echo "<tr><td><b>Completing requested tasks/jobs:</b></td><td><img alt=\"yes\" src=\"images/4star.png\" /></td></tr>\n";

		}

		if ($jobdone == '5')

		{

echo "<tr><td><b>Completing requested tasks/jobs:</b></td><td><img alt=\"yes\" src=\"images/5star.png\" /></td></tr>\n";

		}

		

		//comments

			  echo "<tr><td><b>Comments:</b></td><td>$comments</td></tr>\n";

 

// ETC, ETC... 

     

// ETC, ETC...

      echo '</table></div></div>';

		

		include ('footer.html'); 

				exit();

   } // END OF PROCESSING THIS ROW FROM THE DB

} // END OF ITERATING OVER RESULT SET

	

	mysql_free_result ($result); // Free up the resources.	

 

} else { // If it did not run OK.

	echo '<p class="error">Error in sql: '.mysql_error().'</p>';

}

		

	} // End of if (empty($errors)) IF.

	

	

 

	//mysql_close(); // Close the database connection.

		

} // End of the main Submit conditional.

?>

				

<div id="main">

<div class="info">				

						

<h2><strong>Accommodation Search</strong></h2>

<form action="search.php" method="post">

	

	<p>Enter accommodation details to search for review. Enter atleast the NUMBER, FIRSTLINE AND CITY.</p>				

	

	<p>Number: <input type="text" name="number" size="15" maxlength="15" value="<?php if (isset($_POST['number'])) echo $_POST['number']; ?>" /></p>

	<p>First Line: <input type="text" name="firstline" size="15" maxlength="30" value="<?php if (isset($_POST['firstline'])) echo $_POST['firstline']; ?>" /></p>

	<p>Second Line: <input type="text" name="secondline" size="20" maxlength="40" value="<?php if (isset($_POST['secondline'])) echo $_POST['secondline']; ?>"  /> </p>

	<p>City: <input type="text" name="city" size="10" maxlength="20" value="<?php if (isset($_POST['city'])) echo $_POST['city']; ?>" /></p>

	<p>County: <input type="text" name="county" size="10" maxlength="20" value="<?php if (isset($_POST['county'])) echo $_POST['county']; ?>" /></p>

	<p>Postcode: <input type="text" name="postcode" size="10" maxlength="20" value="<?php if (isset($_POST['postcode'])) echo $_POST['postcode']; ?>" /></p>

	<div style="width: 80px; float: left;">

                            Year:</div>

                        <div style="float: left; width: auto;">

                        <select name="year" id="year"></div>

                        <option value="08-09">2008-2009</option>

                        <option value="07-08">2007-2008 </option>

                        <option value="06-08">2006-2007</option>

						</select>

	

	

	

					

	<p><input type="submit" name="submit" value="Submit" /></p>

	<input type="hidden" name="submitted" value="TRUE" />

</form>

		<!-- End of page-specific content. -->

		<!-- Script 3.3 - footer.html -->

	</div><!-- End of "content" DIV. -->

				</div>

	

	

</div><!-- End of "wrapper" DIV. -->

</body>

</html>

Open in new window

0
Comment
Question by:crojet
2 Comments
 
LVL 12

Expert Comment

by:lexxwern
ID: 24025723
Can you post the specific query and the table structure where you are facing the problems?
0
 

Accepted Solution

by:
crojet earned 0 total points
ID: 24026396
Thanks for the reply, sorry i dont know how the query goes, which table do you mean. The database?
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Creating and Managing Databases with phpMyAdmin in cPanel.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now