0

I am trying to collect data from a few attribues from a MYSQL database to be viewed on a webpage, but I have an error somewhere in my code and really cannot figure it out. Please be patient since I am new to this. Below is my code:

<html>
    <head>
        <meta content="text/html; charset=ISO-8859-1"  http-equiv="content-type">
        <title>
            Food Orders 
        </title>
        <link rel="stylesheet" type ="text/css" href="default.css">
    </head>
    <body>
        <?php
        $server_name = "localhost";
        $user_name = "root";
        $password = "my_pass";
        $database_name = "menudb";
        $connection = new mysqli($server_name, $user_name, $password, $database_name);
        if ($connection->connect_error) {
            die("Connection Error: " . $connection->connect_error);
        }
        $attributes "SELECT tablenumber, food FROM clients";
        $results = $connection->query($attributes);
        if ($results->num_rows > 0) {
            while ($rows = $results->fetch_assoc()) {
                echo "Table Number: " . $rows["tablenumber"]. " Food Item: " . $rows ["food"].
                    "<br>";
            }
        } else {
            echo "No Results";
        }
        $connection->close();
        ?>
    </body>
</html>

Thanks in advance

IanD
  • 11
  • 4

0 Answers0