I searched and searched and couldnt find any answer to my question So I'm sorry if this is a repost newbie here.
I have this function in a separate file called functions.php
function get_all_posts(){
global $connection;
$q = "SELECT * FROM blog LIMIT 1";
$get_posts = mysqli_query($connection, $q);
if (!$get_posts){
die ('Query failed.');
}
return $get_posts;
}
And a called to function in blog.php
<div class="group">
<?php get_all_posts();
while ($row = mysqli_fetch_array($get_posts)){
?>
<h1><?php echo $row['title']; ?></h1>
<?php } ?>
</form>
</div>
But I keep having an undifined variable $get_posts.