When I used gidgreen's solution in my own import php file, I got an error:
define('QA_BASE_DIR', dirname(empty($_SERVER['SCRIPT_FILENAME']) ? __FILE__ : $_SERVER['SCRIPT_FILENAME']).'/');
define('QA_INCLUDE_DIR', QA_BASE_DIR.'qa-include/');
error_reporting(E_ALL);
require_once QA_INCLUDE_DIR.'qa-base.php';
require_once QA_INCLUDE_DIR.'qa-app-post-create.php';
$db = qa_base_db_connect(null);
qa_question_create($db, null, null, null, "sample question", "sample question", "sample, tag", false, null);
Produced an error: "Reading one value from invalid result" at the ultimate point where the query is sent to mysql.
Stepping through the code I saw that the db functions set the global db resource variable "$qa_db".
I changed the db code above (replaced the last two lines) to:
qa_base_db_connect(null);
qa_question_create($qa_db, null, null, null, "sample question", "sample question", "sample, tag", false, null);
and that worked fine. Of course perhaps I'm omitting setup code in my php file that causes gidgreens solution not to work but I hope this snippit helps someone use their own code from scratch.