Q:

My fetch appears not to get any results

I want to use this code to fetch content out of the database, database connection is made with global $connect and is working correctly. But I do not understand why there is no content available on the web page. If someone can help me with this, that would be very appreciated. 
    <div class="content">   

                <article class="fullcontent">   
                    <header>
                        <h2>Advertenties</h2>
                    </header>

                        <content>

                            <?php

                                global $connect;
                                $sql2 = "SELECT * FROM advertentie";
                                $result2 = $connect->query($sql);

                                if ($result->num_rows > 0){
                                    while ($row = $result -> fetch_assoc()){
                                        echo "<div class='fixed-groups'>"; 
                                        echo    "<a class='fixed-group-item' href='website'>";
                                        echo    "<div class='image'>";
                                        echo        "<img src='cms/pages/afbeeldingen/".$row['filename']."' width='173px' height='138px' />";
                                        echo    "</div></a>";
                                        echo    "<strong>".$row['advertentie_titel']."</strong>";
                                        echo    "<span>".$row['verkoopprijs']."</span>";
                                        echo  "</div>";
                                    }
                                }
                            ?>
                        </content>

If someone got some tips for me on how to improve this, many thanks! I don't know how to assign a href to a inserted form, so when I insert a form that form also has to get his own web page. how can I manage that?

A:

You assigned the sql query to $sql2 and ran $sql in $connect->query($sql)
Correct would be: 
$sql2 = "SELECT * FROM advertentie";
$result2 = $connect->query($sql2);

