It should just be:
<?php
$createtemptable = new WA_MySQLi_Query($RPi);
$createtemptable->setQuery("create temporary table currentIDs select distinct(project_id) from oldcredits union select distinct(ID) from projects");
$createtemptable->execute();
?>