The solution from Studio Junkies seem to work. However it will require lots of queries. With the solution below you only have to use 2 queries to the database.
$sql = "SELECT tbl_q.q_id
FROM tbl_q
LEFT JOIN tbl_a ON tbl_q.q_id = tbl_a.qFK
WHERE tbl_a.qFK IS NULL"
$result = mysql_query($sql);
$sql2 = "INSERT INTO tbl_a (qFK) VALUES (";
$first = 1;
while ($row = mysql_fetch_array($result))
{
if ($first == 0) // If $first is 0 then we should add a comma
{
$sql2 = $sql2 . ", " . $row['q_id'];
}
else
{
$sql2 = $sql2 . $row['q_id'];
$first = 0;
}
}
$sql2 = $sql2 . ");";
mysql_query($sql2);