-1

I've been trying to display my database and I just cannot get it to work. Any help appreciated. I've been trying to fis for over 3 hours and getting nowhere

Here's the code:

    <table>
        <caption><h1>Albums Details</h1></caption>
        <thead>
            <tr>
                <th>albumID</th>
                <th>Title</th>
                <th>Artist</th>
                <th>Country</th>
                <th>Company</th>
                <th>Price</th>
                <th>Year</th>
            </tr>
        </thead>
        <tbody>
            <?php 
HERE IS ERROR   while ($res = mysqli_fetch_array($query)) { //while loop....do this

                echo "<tr>";
                echo "<td>".$res['albumID']."</td>";
                echo "<td>".$res['title']."</td>";
                echo "<td>".$res['artist']."</td>";
                echo "<td>".$res['country']."</td>";
                echo "<td>".$res['company']."</td>";
                echo "<td>".$res['price']."</td>";
                echo "<td>".$res['year']."</td>";
                echo "</tr>";
            }
            ?>
SSI
  • 159
  • 1
  • 2
  • 8

1 Answers1

-1

You need to execute the query before you can retrieve the query results.

Ignacio Vazquez-Abrams
  • 740,318
  • 145
  • 1,296
  • 1,325