Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
80 views
in Q2A Core by
something like this:

["Tutorials","Microsoft","Windows 10"]

1 Answer

0 votes
by
 
Best answer

https://www.question2answer.org/qa/20989/add-categories-via-sql

define(QA_VERSION,"1.8.2");

$_SERVER['SERVER_NAME']='technowikis.com';

   require_once 'qa-config.php';

   require_once '../../qa-include/qa-base.php';

   require_once '../../qa-include/qa-db.php';

   require_once '../../qa-include/qa-db-admin.php';

   

   

        $categories = array("Fistory");

    // Create Categories    

    for($i = 0 ; $i < count($categories) ; $i++) {

        echo "Processing category $i $categories[$i] : ";

        

        $categories[$i] = strtolower(str_replace(' ', '-', $categories[$i]));

        //$categories[$i] = strtolower($categories[$i]);

        

        if (qa_db_read_one_value(qa_db_query_sub('SELECT categoryid FROM ^categories WHERE parentid<=># AND tags=$',NULL, $categories[$i]), true)) {

            echo $categories[$i] . " already exists <br/>";

        } else {

            $categoryid = qa_db_category_create(NULL, $categories[$i], $categories[$i]);

            echo "created successfully <br/>";

        }

    }
...