• Resolved furansco

    (@furansco)


    Hi. First, great plugin!

    Since I couldn’t find a documentation page for this plugin, I’m wondering if it is possible to retrieve the saved entries using a traditional PHP function and then foreach everything to display the reservations in any way I want.

    Thanks for your attention.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Arshid

    (@arshidkv12)

    This plugin is saving data by using serialized php function. We need to write custom code. I can make custom plugin for you. Please PM.

    Thread Starter furansco

    (@furansco)

    Hello again.
    Not really in the need of a special plugin o anything, I’m really just looking for a function or at least a code that could help me.
    Well, I actually got it by doing some research.

    $start = $page * 10;
    
            $args = array(
                'post_type'=> 'wpcf7_contact_form',
                'order'    => 'ASC',
                'posts_per_page' => 10,
                'offset' => $start
            );
    
            $the_query = new WP_Query( $args );
            global $wpdb;
            $cfdb = apply_filters( 'cfdb7_database', $wpdb );
            $table_name = $cfdb->prefix.'db7_forms';
            $form_post_id = 0; //Table ID
            $results = $cfdb->get_results( "SELECT form_value FROM $table_name 
            WHERE form_post_id = $form_post_id ORDER BY form_id DESC LIMIT 100", OBJECT );
    
            foreach ($results as $rowID => $row) {
            	$values = unserialize($row->form_value);
            	foreach ($values as $field => $value) {
            		$html .= $field.' : '.$value.'<br>';
            	}
            	$html.= '<hr>';
            }
            echo $html;

    You can help other people by wrapping this into a function.
    Thanks again for your support and for bringing this useful plugin.

    Thanks, Furansco.

    How we can use this code?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Function to display saved entries in PHP template’ is closed to new replies.