Jump to content

i would like to at a php string to my script...can any one help?


nicandre

Recommended Posts

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

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.