1

I am using PHRETS Class in order to fetch the data of my search creteria but it keep showing 0 records found.

Below is the code I am using. All is well but it keep saying same error message again and again.

Here is my code:

<?php @include_once('login.php'); ?>
<pre>
<?php

$rets = new PHRETS;

$connect = $rets->Connect($login, $un, $pw);

if($connect) {

    $sixmonths = date('Y-m-d\TH:i:s', time()-15778800); // get listings updated within last 6 months

    /* Search RETS server */
    $search = $rets->SearchQuery(
        'Property',                             // Resource
        'ResidentialProperty',                  // Class
        '((112='.$sixmonths.'+),(178=ACT))',    // DMQL, with SystemNames
        array(
            'Format'    => 'COMPACT-DECODED',
            'Select'    => 'sysid,49,112,175,9,2302,2304',
            'Count'     => 1,
            'Limit'     => 20
        )
    );

    /* If search returned results */
    if($rets->TotalRecordsFound() > 0) {
        while($data = $rets->FetchRow($search)) {
            print_r($data);
        }
    } else {
        echo '0 Records Found';
    }

    $rets->FreeResult($search);
    $rets->Disconnect();
} else {
    $error = $rets->Error();
    print_r($error);
}

?>
</pre>

I want to fetch records in a way that If user selects bath 2, bedroom 4 and price > 12000000.

I want to search all the records based on this criteria and shows the results on the page.

Keep Coding
  • 636
  • 9
  • 26
  • it keep saying: `0 Records Found`. No data is coming. – Keep Coding Feb 02 '15 at 14:19
  • Do you mind pasting the metadata for ResidentialProperty? I see this code is very similar to this [link](http://dangodesign.net/2013/01/getting-started-with-rets-for-php/). Are you sure the RETS Server is the system described in the link above? – dj_goku Feb 03 '15 at 03:03
  • Here is the link to the metadata: [link](http://justpaste.it/j80r) – Keep Coding Feb 03 '15 at 06:13
  • Sorry I am not sure about this. Can you please explain or help me out mate? I am badly stuck. – Keep Coding Feb 03 '15 at 06:14
  • Try this DMQL: ((BATH_TOT=2),(BR=4)) Next time I suggest pasting text vs a png since you can't search a png. I would also suggest pasting all the metadata in whole un-modified. I couldn't find listing price in the metadata you sent so you'll have to look through the metadata to figure out which field is listing price. – dj_goku Feb 03 '15 at 13:24

1 Answers1

0

Are you sure the system name(178) that you gave in DMQL query,

((112='.$sixmonths.'+),(178=ACT))

is not a look-up field?

If look-up, then we may need to give the query with "|" symbol. like this,

((112='.$sixmonths.'+),(178=|ACT))

V-T
  • 756
  • 2
  • 9
  • 22