How can I keep checking for posts with PHP? I have a piece of code that goes through and gets all the posts. When I do echo $row[\'post_message\']; I get all of th
Your issue lies in your while loop. You keep overwriting the $post variable. It should be:
$posts = array();
while($row = $stmt->fetch(PDO::FETCH_ASSOC)){
$posts[] = $row['post_message'];
}
Which should return:
Array (
[0] => I like pie I like pie 2,
[1] => alex likes food
)
This allows you to do something like this (as an example):
foreach($posts as $post) {
echo 'The user posted: ' . $post . '
';
}