nicandre Posted June 22, 2008 Share Posted June 22, 2008 i have this script and i would like to add another string to it, where in the search box i want to serach for ref no from my sql database...how can i add a new string to it? <?php } else if ( $cgi->getValue ( "op" ) == "search" ) { $pt = $cgi->getValue ( "pt" ); $pp = $cgi->getValue ( "pp" ); $pb = $cgi->getValue ( "pb" ); $pl = $cgi->getValue ( "pl" ); $po = $cgi->getValue ( "po" ); $pp_min = $cgi->getValue ( "pp_min" ); $pp_max = $cgi->getValue ( "pp_max" ); $query = " SELECT p.id AS id, p.propertyoption AS propertyoption, p.propertyprice AS propertyprice, p.propertyaddress AS propertyaddress, pl.propertylocation AS propertylocation, ps.propertystatus AS propertystatus, pt.propertytype AS propertytype, p.propertyref AS propertyref, p.propertybedrooms AS propertybedrooms, p.propertyphoto1 AS propertyphoto1, p.propertyphoto2 AS propertyphoto2, p.propertyphoto3 AS propertyphoto3, p.propertyphoto4 AS propertyphoto4, p.shortdescription AS shortdescription, p.longdescription AS longdescription, p.virtualtour AS virtualtour FROM " . $property_table . " p INNER JOIN " . $propertytypes_table . " pt ON (p.propertytype=pt.id) INNER JOIN " . $propertylocations_table . " pl ON (p.propertylocation=pl.id) INNER JOIN " . $propertystatus_table . " ps ON (p.propertystatus=ps.id) WHERE p.propertyshow=1 "; if ( $ppropertyref != "" ) $query .= " AND p.propertyref>=" . $sql->quote ( $ppropertyref ); if ( $pt != "" ) $query .= " AND p.propertytype=" . $sql->quote ( $pt ); if ( $pp_min != "" ) $query .= " AND p.propertyprice>=" . $sql->quote ( $pp_min ); if ( $pp_max != "" ) $query .= " AND p.propertyprice<=" . $sql->quote ( $pp_max ); if ( $pb != "" ) $query .= " AND p.propertybedrooms>=" . $sql->quote ( $pb ); if ( $pl != "" ) $query .= " AND p.propertylocation=" . $sql->quote ( $pl ); if ( $po != "" ) $query .= " AND p.propertyoption=" . $sql->quote ( $po ); // set the query ordering if ( isset ( $property_search_order ) && $property_search_order != "" ) $query .= "ORDER BY p." . $property_search_order . " " . ( "a" == strtolower ( substr ( $property_search_ordering, 0, 1 ) ) ? "ASC" : "DESC" ); $results = $sql->execute ( $query, SQL_RETURN_ASSOC ); $total_results = sizeof ( $results ); if ( $total_results == 0 ) { ?> <br /> <br /> <p align="center"><?php echo GENERAL_NO_PROPERTIES_FOUND; ?></p> <br /> <br /> <br /> <?php Quote Link to comment Share on other sites More sharing options...
Xeoncross Posted June 24, 2008 Share Posted June 24, 2008 i have this script and i would like to add another string to it, where in the search box i want to serach for ref no from my sql database...how can i add a new string to it? I wish to add a section to this SQL query which would enable me to search a property based upon a reference number. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.