0

Hi All,

im having a problem with searching a database in dreamweaver and was wondering if anyone here has tried it? its a mysql database. here is the situation. i have DB called real_db with a table in i call listings. i want to be able to search the db and display results on a page... so far its not working... it shows me everything BUT the results i want. if anyone has moment to review my code and make suggestions i would GREATLY appreciate it

<?php
	require_once('auth.php');
?>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
@import url("images/style.css");
#apDiv2 {
	position:absolute;
	width:437px;
	height:43px;
	z-index:1;
	text-align: center;
	left: 8px;
	top: 45px;
}
#apDiv3 {
	position:absolute;
	width:417px;
	height:42px;
	z-index:2;
	left: -82px;
	top: 3px;
	text-align: center;
}
#apDiv {	position:absolute;
	width:504px;
	height:211px;
	z-index:1;
	left: 2px;
	top: 106px;
	text-align: right;
}
#apDiv4 {	position:absolute;
	width:313px;
	height:20px;
	z-index:3;
	left: 191px;
	top: 148px;
}
#apDiv5 {
	position:absolute;
	width:438px;
	height:362px;
	z-index:2;
	top: 95px;
	left: 10px;
}
</style>
</head>

<body>
<div class="titletext" id="apDiv2">Search listings</div>
<div id="apDiv5">
  <form id="form1" name="form1" method="get" action="/realwww/searchhouse.php">
    <table width="313" height="303" align="center">
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Sale type:</td>
        <td><select name="sale_type">
          <option value="Residential" <?php if (!(strcmp("Residential", ""))) {echo "SELECTED";} ?>>Residential</option>
          <option value="Commercial" <?php if (!(strcmp("Commercial", ""))) {echo "SELECTED";} ?>>Commercial</option>
          <option value="Land" <?php if (!(strcmp("Land", ""))) {echo "SELECTED";} ?>>Land</option>
          <option value="Farm" <?php if (!(strcmp("Farm", ""))) {echo "SELECTED";} ?>>Farm</option>
          <option value="New Developments" <?php if (!(strcmp("New Developments", ""))) {echo "SELECTED";} ?>>New Developments</option>
        </select></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Home type:</td>
        <td><select name="home_type">
          <option value="House" <?php if (!(strcmp("House", ""))) {echo "SELECTED";} ?>>House</option>
          <option value="Cluster" <?php if (!(strcmp("Cluster", ""))) {echo "SELECTED";} ?>>Cluster</option>
          <option value="Apartment" <?php if (!(strcmp("Apartment", ""))) {echo "SELECTED";} ?>>Apartment</option>
          <option value="Duplex" <?php if (!(strcmp("Duplex", ""))) {echo "SELECTED";} ?>>Duplex</option>
          <option value="Simplex" <?php if (!(strcmp("Simplex", ""))) {echo "SELECTED";} ?>>Simplex</option>
        </select></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Price:</td>
        <td><input type="text" name="Price" value="" size="32" /></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Bedrooms:</td>
        <td><select name="Bedrooms">
          <option value="0" <?php if (!(strcmp(0, ""))) {echo "SELECTED";} ?>>0</option>
          <option value="1" <?php if (!(strcmp(1, ""))) {echo "SELECTED";} ?>>1</option>
          <option value="2" <?php if (!(strcmp(2, ""))) {echo "SELECTED";} ?>>2</option>
          <option value="3" <?php if (!(strcmp(3, ""))) {echo "SELECTED";} ?>>3</option>
          <option value="4" <?php if (!(strcmp(4, ""))) {echo "SELECTED";} ?>>4</option>
          <option value="5" <?php if (!(strcmp(5, ""))) {echo "SELECTED";} ?>>5+</option>
        </select></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Bathrooms:</td>
        <td><select name="bathrooms">
          <option value="1" <?php if (!(strcmp(1, ""))) {echo "SELECTED";} ?>>1</option>
          <option value="2" <?php if (!(strcmp(2, ""))) {echo "SELECTED";} ?>>2</option>
          <option value="3" <?php if (!(strcmp(3, ""))) {echo "SELECTED";} ?>>3</option>
          <option value="4" <?php if (!(strcmp(4, ""))) {echo "SELECTED";} ?>>4+</option>
        </select></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Number:</td>
        <td><input type="text" name="number" value="" size="32" /></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Street address:</td>
        <td><input type="text" name="street_address" value="" size="32" /></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Suburb:</td>
        <td><input type="text" name="suburb" value="" size="32" /></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">Province:</td>
        <td><select name="province">
          <option value="Eastern Cape" <?php if (!(strcmp("Eastern Cape", ""))) {echo "SELECTED";} ?>>Eastern Cape</option>
          <option value="Free State" <?php if (!(strcmp("Free State", ""))) {echo "SELECTED";} ?>>Free State</option>
          <option value="Gauteng" <?php if (!(strcmp("Gauteng", ""))) {echo "SELECTED";} ?>>Gauteng</option>
          <option value="Kwa-Zulu Natal" <?php if (!(strcmp("Kwa-Zulu Natal", ""))) {echo "SELECTED";} ?>>Kwa-Zulu Natal</option>
          <option value="Limpopo" <?php if (!(strcmp("Limpopo", ""))) {echo "SELECTED";} ?>>Limpopo</option>
          <option value="Mpumalanga" <?php if (!(strcmp("Mpumalanga", ""))) {echo "SELECTED";} ?>>Mpumalanga</option>
          <option value="North West" <?php if (!(strcmp("North West", ""))) {echo "SELECTED";} ?>>North West</option>
          <option value="Northern Cape" <?php if (!(strcmp("Northern Cape", ""))) {echo "SELECTED";} ?>>Northern Cape</option>
          <option value="Western Cape" <?php if (!(strcmp("Western Cape", ""))) {echo "SELECTED";} ?>>Western Cape</option>
        </select></td>
      </tr>
      <tr valign="baseline">
        <td nowrap="nowrap" align="right">&nbsp;</td>
        <td><input type="submit" value="Search" /></td>
      </tr>
    </table>
  </form>
</div>
<div id="apDiv3">
  <div id="submenu">
    <div class="smallgraytext" style="padding: 9px; text-align: right;" align="right"><a href="/realwww/newlisting.php" target="mainFrame">Create new listing</a> <img src="images/bg_menu.gif" width="2" height="20" alt="break" /><a href="/realwww/searchlisting.php"> Search listings </a><img src="images/bg_menu.gif" width="2" height="20" alt="" /> <a href="/realwww/view listings.php" target="mainFrame">View your listings </a><img src="/realwww/images/bg_menu.gif" width="2" height="20" alt="" /> <a href="/realwww/updatelisting.php" target="mainFrame">Edit listings</a></div>
  </div>
</div>
</body>
</html>

whoa i didnt realise how long it was... lol.

2
Contributors
2
Replies
4
Views
6 Years
Discussion Span
Last Post by Siboneloz
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.