Advertisement

05.23.2008 at 09:09AM PDT, ID: 23428076
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

$row_Recordset1 has no value to pass

Asked by cataleptic_state in Macromedia Dreamweaver, SQL Query Syntax, WebApplications

Tags: ,

I have a page that displays search results from a form which is include "searchbox.php"
But I cannot get results back using the code that I have attached:

If the search comes back with no results I want the else statement to echo the second table.

the search works if I take the If statement out and leave the while, but IF the user puts in a value that is not in the database it will bring up the empty box, I need to replace the empty box with "Sorry not in stock" Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
127:
128:
129:
130:
131:
132:
133:
134:
135:
136:
137:
138:
139:
140:
141:
142:
143:
144:
145:
146:
147:
148:
149:
150:
151:
152:
153:
154:
155:
156:
157:
158:
159:
160:
161:
162:
163:
164:
165:
166:
167:
168:
169:
170:
171:
172:
173:
174:
175:
176:
177:
178:
179:
180:
181:
182:
183:
184:
185:
186:
187:
188:
189:
190:
191:
192:
193:
194:
195:
196:
197:
198:
199:
200:
201:
202:
203:
204:
205:
206:
207:
208:
209:
210:
211:
212:
213:
214:
215:
216:
217:
218:
219:
220:
221:
222:
223:
224:
225:
226:
227:
228:
229:
230:
231:
232:
233:
234:
235:
236:
237:
238:
239:
240:
241:
242:
243:
244:
245:
246:
247:
248:
249:
250:
251:
252:
253:
254:
255:
256:
257:
258:
259:
260:
261:
262:
263:
264:
265:
266:
267:
268:
269:
270:
271:
272:
273:
274:
275:
276:
277:
278:
279:
280:
281:
<?php require_once('Connections/db.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
 
// define an array of acceptable property types
//$propTypes = array('Houses', 'Flats/Apartments', 'Bungalows','Commercial');
// if submitted value is in the array of acceptable types, use it
// otherwise, use a wildcard character
//if (isset($_REQUEST['PropType']) && in_array($_REQUEST['PropType'], $propTypes)) {
//$PropType == "'".$_REQUEST['PropType']."'";
//} 
 
 
// check that the number of bedrooms is a number
// if it's zero, search for all numbers
//if (isset($_REQUEST['NoBeds']) && is_numeric($_REQUEST['NoBeds']) && 
//$_REQUEST['NoBeds'] == 0) {
//$NoBeds = '> 0';
//} elseif (isset($_REQUEST['NoBeds']) && is_numeric($_REQUEST['NoBeds']) && 
//$_REQUEST['NoBeds'] > 0) {
//$NoBeds = '= '.$_REQUEST['NoBeds'];
//} else {
//$NoBeds = '> 0';
//}
 
//if (isset($_REQUEST['NoBeds']) && is_numeric($_REQUEST['NoBeds']) ) {
//$NoBeds = $_REQUEST['NoBeds'];
//} 
//else {
//$NoBeds = '> 0';
//}
 
// if minPrice is not a number, set it to zero
// otherwise, use the submitted value
//if (isset($_REQUEST['minPrice']) && !is_numeric($_REQUEST['minPrice']) || 
//!isset($_REQUEST['minPrice'])) {
//$minPrice = 0;
//} elseif (isset($_REQUEST['minPrice']) && is_numeric($_REQUEST['minPrice'])) {
//$minPrice = $_REQUEST['minPrice'];
//}
 
// if maxPrice is not a number, set it to 100 million
// otherwise, use the submitted value
//if (isset($_REQUEST['maxPrice']) && !is_numeric($_REQUEST['maxPrice']) || 
//!isset($_REQUEST['maxPrice'])) {
//$minPrice = 100000000;
//} elseif (isset($_REQUEST['maxPrice']) && is_numeric($_REQUEST['maxPrice'])) {
//$minPrice = $_REQUEST['maxPrice'];
//}
mysql_select_db($database_db, $db);
 
$query_Recordset1 = 	"SELECT * 
						FROM property 
						WHERE B_R = 'BUY'
						AND Accepted = 'Yes' 
						AND (City = '$_REQUEST[q]' Or Postcode = '%$_REQUEST[q]' Or Area = '$_REQUEST[q]')
						AND NoBeds = '$_REQUEST[NoBeds]'
						AND Cost BETWEEN $minPrice AND $maxPrice
						ORDER BY Cost $_REQUEST[sort]";
 
$Recordset1 = mysql_query($query_Recordset1, $db) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
 
$currentPage = $_SERVER["PHP_SELF"];
 
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
 
				
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $db) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
 
if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
 
$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Recordset1") == false && 
        stristr($param, "totalRows_Recordset1") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
 
?>
<html>
<head>
<title>Liquid Estates</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 12px;
}
.style10 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; }
-->
</style>
<link href="style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style14 {
	font-size: 14px;
	font-weight: bold;
}
-->
</style>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- ImageReady Slices (Untitled-2.psd) -->
<table width="766" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01">
<tr>
		<td colspan="2" valign="top">
			<img src="images/index_01.jpg" alt="" width="766" height="204" border="0" usemap="#Map"></td>
  </tr>
	<tr>
		<td valign="top" background="images/base.gif">
			<img src="images/index_02.jpg" width="249" height="55" alt=""></td>
		<td width="517" rowspan="4" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td class="style10">Search Results</td>
              </tr>
              <tr>
                <td>
				<?php do { 
                 if ($row_Recordset1['PropID'] ==!"") {
				echo
                  '<table width="100%" border="0" bordercolor="#F5AF01" class="style1">
                    <tr>
                      <td width="90" height="108" valign="top"><div align="center"><a href="property.php?PropID=<?php echo "$row_Recordset1[PropID]"; ?>"><img src="images/<?php echo $row_Recordset1["Lrg_Image"]; ?>" width="90" height="90" border="0" /></a><a href="property.php?PropID=<?php echo "$row_Recordset1[PropID]"; ?>" class="textLink"><br />
                        More Info</a></div></td>
                      <td valign="top"><table width="100%" border="0">
                          <tr>
                            <td width="327" valign="top" background="images/line2.jpg" class="header"><span class="style14">Guide Price: &pound;<?php echo number_format($row_Recordset1["Cost"],2); ?></span></td>
                          </tr>
                          <tr>
                            <td><p> <?php echo $row_Recordset1["NoBeds"]; ?> Bed <?php echo $row_Recordset1["PropBuild"]; ?><br />
                                  <span class="textPropertyHeading"><?php echo $row_Recordset1["Address"]; ?></span>, <span class="textPropertyHeading"><?php echo $row_Recordset1["City"]; ?></span></p>
                                <p class="guidePrice">&nbsp;</p></td>
                          </tr>
                      </table></td>
                    </tr>
                  </table>';}
			else {
			echo '<table width="333" border="0" bordercolor="#F6B000">
                    <tr>
                      <td width="229" height="108" valign="top"><table width="229" border="0" class="style1">
                          <tr>
                            <td width="223" valign="top">There are no properties for this search option.</td>
                            </tr>
                          <tr>
                            <td></td>
                            </tr>
                      </table></td>
                      <td width="147" valign="top"></td>
                    </tr>
                  </table>
                  </td>
              </tr>
            </table>';
			}
			
                  } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
                <p class="style1"></p></td>
              </tr>
            </table>
              <h4></h4>            </td>
            <td valign="top"></td>
          </tr>
        </table>
		  <p class="style1">&nbsp;</p>	    </td>
  </tr>
	<tr>
		<td width="249" valign="top" background="images/base.gif" class="sidebar">
		<!--<form name="form2" method="post" action="">
		  <label class="name">
		  <input type="radio" name="radio" id="radio" value="BUY" onChange="form2.submit();">
		  For Sale</label>
                <label>
                <input type="radio" name="radio2" id="radio2" value="LET" onChange="form2.submit();">
                <span class="name">To Let</span></label>
		</form>-->
		<?php 
		/*switch ($_POST["radio"])       
		{
		case "sale":
		$val="searchbox.php";                    
		break;
 
		case "let":
		$val="searchbox_let.php";                    
		break;
 
		default:
		$val="searchbox.php";
		}
		include "$val"; */
       if (isset($_POST['radio'])) {
	   include "searchbox.php";
	   }
	   elseif (isset($_POST['radio2'])) {
	   include "searchbox_let.php";
	   }
	   else include "searchbox.php";
	   ?>
	  <?php //include "searchbox.php"; ?></td>
  </tr>
	<tr>
		<td valign="top">&nbsp;</td>
  </tr>
	<tr>
		<td valign="top">&nbsp;</td>
  </tr>
	<tr>
		<td width="766" height="10" colspan="2">
			<img src="images/spacer.gif" width="766" height="10" alt=""></td>
  </tr>
	<tr>
		<td colspan="2">
			<img src="images/index_08.jpg" width="766" height="92" alt=""></td>
	</tr>
</table>
 
 
<map name="Map"><area shape="rect" coords="336,26,391,40" href="index.php">
<area shape="rect" coords="413,25,471,41" href="for_sale.php">
<area shape="rect" coords="493,25,551,39" href="to_let.php">
<area shape="rect" coords="571,27,655,39" href="commercial.php">
<area shape="rect" coords="669,27,750,38" href="contact.php">
</map></body>
</html>
<?php
mysql_free_result($Recordset1);
?>
[+][-]05.23.2008 at 09:30AM PDT, ID: 21633588

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]05.27.2008 at 01:33AM PDT, ID: 21650270

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Macromedia Dreamweaver, SQL Query Syntax, WebApplications
Tags: PHP/MySQL, FF, IE
Sign Up Now!
Solution Provided By: cataleptic_state
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-42 / EE_QW_2_20070628