Answered: How can i use qa-app-posts.php to insert a lot of questions to the DB?

Post date: 2020-07-11 02:07:16
Views: 122

The basic structure would be like this:

<?php
require_once '/PATH/TO/qa-include/qa-base.php';
require_once QA_INCLUDE_DIR.'app/posts.php';

$questions = ]; // do something here to get your list of questions

foreach ($questions as $question) {
    qa_post_create('Q', null, $title, $content, $format, $categoryid, $tags, $userid);
}

The variables like $title would come from your questions array, so it may be $questions'title'], $questions'content'] and so on. If you don't have a user ID to use then use null and they will show as anonymous.

Please click Here to read the full story.
 
Other Top and Latest Questions:
Can a category be hidden from search results and not appear on the first page?
6 portfolio stock earnings and the Fed's favorite inflation gauge dominate the week ahead
Homeownership isn't for everyone, money coach says: Don't fall for artificial 'pressure to buy'
Reed Hastings shares the 3-word tactic that helped make Netflix a $240 billion company—it's called 'farming for dissent'
Nvidia dragged to worst day since March 2020 after Super Micro plunge
I'm a professional poker player, and have trouble sleeping, please help!
Is this paper shady or were the things the paper talk about shady?
U.S. House to vote on long-awaited $95 billion Ukraine, Israel aid package
Why the oil market shrugged as Iran and Israel appeared on the brink of war this week
Tesla recalls Cybertruck over 'trapped pedal' issue seen in owner's viral TikTok video