I currently need to create a table that auto fills depending on how many entities there is in the database.
I currently have a simple select statement;
$articleID = $_GET['id'];
$stmt = $pdo->query('SELECT * FROM article WHERE articleID = "' . $articleID . '"');
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt2 = $pdo->query('SELECT * FROM comments WHERE artID = "' . $articleID . '"');
$result2 = $stmt2->fetch(PDO::FETCH_ASSOC);
I tried using a Form but that only stores one piece of data.
From your SQL code I gather that articleId is the primary key the article table and that artId in the comments table is a foreign key.
So your first query should return only on result hence the fetch method. The second query on the other hand could returns many rows, but the fetch method only returns the first one. To get an array of results you should use the fetchAll method and loop over the resulting array to show all the comments.
Here is a code with the two resultset dumped to help you see the structure. I also gave you a simple example of how you could loop over the second result.
$articleID = $_GET['id'];
$stmt = $pdo->query('SELECT * FROM article WHERE articleID = "' . $articleID . '"');
$result = $stmt->fetch(PDO::FETCH_ASSOC);
$stmt2 = $pdo->query('SELECT * FROM comments WHERE artID = "' . $articleID . '"');
$result2 = $stmt2->fetchAll(PDO::FETCH_ASSOC);
var_dump($result);
var_dump($result2);
foreach($result2 as $comment){
echo '<p>'.$comment['text'].'<p>';
}