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

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.