<?php
    require_once 'init.php';
    $selectpost = mysql_query("
        SELECT 
         posts.id, 
         posts.author, 
         posts.postText
        FROM posts
        GROUP BY posts.id
   ");
    while($row = mysqli_fetch_object($selectpost)) { //line 30
        $posts[] = $row;    
    }
?>
<?php foreach($posts as $post): ?> //line 37
    <div class="post row">
     <p><?php echo $post->author; ?> said: </p>
     <p><?php echo $post->postText; ?></p>
    </div>
<?php endforeach; ?>
I am trying to display some posts from a database. This is my code I have written so far. For some reason I am getting these errors:
Warning: mysqli_fetch_object() expects parameter 1 to be mysqli_result, boolean given in posts.php on line 30
Notice: Undefined variable: posts in posts.php on line 37
Warning: Invalid argument supplied for foreach() in posts.php on line 37
I have commented on the appropriate lines.
 
     
    