Files
crm.clientright.ru/check_account.php

26 lines
778 B
PHP

<?php
require_once('config.php');
global $adb;
$account_id = 393242;
$query = "SELECT accountid, accountname FROM vtiger_account WHERE accountid = ?";
$result = $adb->pquery($query, array($account_id));
if ($adb->num_rows($result) > 0) {
echo "Account $account_id exists: " . $adb->query_result($result, 0, 'accountname') . PHP_EOL;
} else {
echo "Account $account_id does not exist" . PHP_EOL;
}
// Проверим также через crmentity
$query2 = "SELECT crmid FROM vtiger_crmentity WHERE crmid = ? AND deleted = 0";
$result2 = $adb->pquery($query2, array($account_id));
if ($adb->num_rows($result2) > 0) {
echo "Account $account_id exists in crmentity" . PHP_EOL;
} else {
echo "Account $account_id does not exist in crmentity" . PHP_EOL;
}
?>