问题
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