The use of wpdb->insert
and wp_insert_post
both accomplish an SQL Insert, which is why you’re seeing 2 records each time. You must use only one instance of an insert method, and then Pass $my_post
to WP_Query
CLARIFICATION
As Milo points out in his comment wpdb->insert
will insert into any table, while wp_insert_post
is used to insert a post into the wp_posts table. wpdb->insert
is used mainly for custom tables.
In your case:
<?php $wpdb->insert( 'auto_importare', $insData); ?>
Sticking with the premise that $wpdb should be used for custom tables, you would then use wpdb->get_results
to select the data you just inserted:
<?php $post_results -> $wpdb->get_results( 'SELECT make,model, version,description FROM wpdb->auto_importare'); ?>
Lastly, and this part escapes me at the moment, you would build your post query from $post_results