Arrays and Functions Query
-
I’m building my site on WordPress and as a beginner I’m doing a proof of concept which will focus on entering data into a form and seeing if I can retrieve and display the results.
I can see within mysql where the data is being saved. The providers of the form – Ninja Forms, suggest that I use a function. That function would return a PHP array containing all of the submissions that it found. You’d then need to loop through those and display them using PHP.
My questions are:
1) Where do I place this function? For testing purposes can I put it simply within the index.php file?
2) Once I’ve placed my function, what do I need to do in terms of creating a loop?
3) How do I display the results from the loop?
Here is a copy of the function:
$args = array(
‘form_id’ => 4, // Only include submission from the form with an ID of 4
‘user_id’ => 5, // Only include submissions from the user with an ID of 5
3 => ‘test’ // Only include submissions where the field with an ID of 3 has a user value of ‘test’
);
$sub_results = ninja_forms_get_subs( $args ); // This is an array of submission results.Thank You
- The topic ‘Arrays and Functions Query’ is closed to new replies.