PHRETS is not searching the data

こ雲淡風輕ζ 提交于 2019-12-11 10:55:09

问题


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.


回答1:


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))



来源:https://stackoverflow.com/questions/28279504/phrets-is-not-searching-the-data

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!