function update_current() { global $rets, $useradmin, $insert_size; $sysid_array = $rets->GetDataArray('Property', '11', '(363=|A)', 'sysid', null); $truncateSQL = "TRUNCATE TABLE sysid_raw_current"; $result = mysql_query_or_die($truncateSQL, $useradmin); foreach ($sysid_array as $index => $array) { insert_sysid($array['sysid']); } echo "<br/>{$insert_size} records have been inserted to the database<br/>"; }
$current_YVR_time_string = date("Y-m-d H:i:s", $current_YVR_time); //The following code is to test if the cron job is executed. $file = "file.txt"; $current = file_get_contents($file); $current .= "{$current_YVR_time_string}\n"; file_put_contents($file, $current); //login and receive server response. $response = $rets->Login(); var_dump($response); //$response=$rets->GetCount('Property','11','(363=|A)'); //print $response.'<br/>'; $sysid_array = $rets->GetDataArray('Property', '11', '(363=|A)', 'sysid', null); //echo count($sysid_array).'<br/>'; foreach ($sysid_array as $index => $array) { //echo '<br/>['.$index.']'.$array['sysid'].'<br/>'; insert_sysid($array['sysid']); } $selectSQL = "SELECT sysid FROM sysid_raw WHERE imported='N' AND problem='N' LIMIT 0, 50"; $get_sysid = mysql_query_or_die($selectSQL, $useradmin); while ($row_get_sysid = mysql_fetch_assoc($get_sysid)) { $new_sysid = $row_get_sysid['sysid']; $listing_array = $rets->GetDataArray('Property', '11', '(sysid=' . $new_sysid . ')', null, null); if (insert_update_listing($listing_array[0])) { if (update_sysid_in_raw($new_sysid)) { echo "<br/><span style=\"color:#336633;\">[info] sysid updated in sysid_raw database. {$new_sysid} imported='Y'.</span><br/>"; } } else { echo "<br/><span style=\"color:#FF0000;\">[warning] didn't get anything from the server</span><br/>"; sysid_problem_in_raw($new_sysid); } }