PHP code example of calderawp / caldera-forms-query
1. Go to this page and download the library: Download calderawp/caldera-forms-query library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
calderawp / caldera-forms-query example snippets
/**
* Examples of simple queries
*
* Using the class: \calderawp\CalderaFormsQuery\Features\FeatureContainer
* Via the static accessor function: calderawp\CalderaFormsQueries\CalderaFormsQueries()
*/
/** First make the function usable without a full namespace */
use function calderawp\CalderaFormsQueries\CalderaFormsQueries;
/** Do Some Queries */
//Select all data by user ID
$entries = CalderaFormsQueries()->selectByUserId(42);
//Select all entries that have a field whose slug is "email" and the value of that field's value is "[email protected]"
$entries = CalderaFormsQueries()->selectByFieldValue( 'email', '[email protected]' );
//Select all entries that do not have field whose slug is "size" and the value of that field's value is "big"
$entries = CalderaFormsQueries()->selectByFieldValue( 'size', 'big', false );
//Delete all data by Entry ID
CalderaFormsQueries()->deleteByEntryIds([1,1,2,3,5,8,42]);
//Delete all data by User ID
CalderaFormsQueries()->deleteByUserId(42);
/**
* Examples of simple queries
*
* Using the class: \calderawp\CalderaFormsQuery\Features\FeatureContainer
* Via the static accessor function: calderawp\CalderaFormsQueries\CalderaFormsQueries()
*/
/** First make the function usable without a full namespace */
use function calderawp\CalderaFormsQueries\CalderaFormsQueries;
/** Do Some Queries */
//Select all entries that have a field whose slug is "email" and the value of that field's value is "[email protected]"
//The first 25 entries
$entries = CalderaFormsQueries()->selectByFieldValue( 'email', '[email protected]' );
//The second 25 entries
$entries = CalderaFormsQueries()->selectByFieldValue( 'email', '[email protected]', true, 2 );
//Get 5th page, with 50 results per page
$entries = CalderaFormsQueries()->selectByFieldValue( 'email', '[email protected]', true, 5, 50 );