Answers.Body: <p>It's probably a permissions issue. By default anonymous doesn't have access to contacts, so you either need to add <code>'checkPermissions' =&gt; FALSE</code> to the parameters or run it as a logged in user with appropriate permissions.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-29T06:11:44.587Z
Answers.LastActivityDate: 2023-03-29T06:11:44.587Z
Answers.UserDisplayName: Demerit
Body: <p>I was new to CiviCRM, I have the following where %search is a variable in the php, it didn't return anything, is it true that cannot passed parameter in this way? Thanks</p>
  <p>$contacts = civicrm_api4('Contact', 'get', [
  'select' =&gt; [
  'id',
  'display_name',
  ],
  'where' =&gt; [
  ['OR', [['id', 'CONTAINS', $search], ['display_name', 'CONTAINS', $search]]],
  ],
  'limit' =&gt; 25,
  ]);</p>
  
Tags: <apiv4>
Title: CiviCRM API v4 didn't recognized php variable
ThreadText: # CiviCRM API v4 didn't recognized php variable
  
  (Asked by: username_0 on 2023-03-28)
  
  I was new to CiviCRM, I have the following where %search is a variable in the php, it didn't return anything, is it true that cannot passed parameter in this way? Thanks
  
  $contacts = civicrm\_api4('Contact', 'get', [
  'select' => [
  'id',
  'display\_name',
  ],
  'where' => [
  ['OR', [['id', 'CONTAINS', $search], ['display\_name', 'CONTAINS', $search]]],
  ],
  'limit' => 25,
  ]);
  
  **Tags:** apiv4
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-03-29. Score: 1
  
  It's probably a permissions issue. By default anonymous doesn't have access to contacts, so you either need to add `'checkPermissions' => FALSE` to the parameters or run it as a logged in user with appropriate permissions.
  
  
  ---
  
  