0

I have no idea what's going on, I have looked over the code and it just wont pull up the webpage. I need help figuring out what is going on with this code.

    <?php
    include ('config.php');
    require('db.php');

   $query = "SELECT * FROM salerecords";
   $result = mysqli_query($conn, $query);
   echo $result;
   $posts = mysqli_fetch_all($result, MYSQLI_ASSOC);
   mysqli_free_result($result);
   mysqli_close($conn);
   ?>
   <html>
   <?php include('header.php'); ?>
   <head>
    <link rel="stylesheet" href="style.css" type="text/css">
    <link rel="stylesheet" type="text/css" 
   href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <title>PHP Stores</title>
   </head>
   <main>
    <div id="user_select">
        <div id="options">
            <div id="view">
                <a href="displayRecs.php"><input type="submit" value="View" class="menu- 
    chosen">
                </a>
            </div>
        </div>
    </div>
</main>
<body>
    <header>Manage Sales Records</header>
    <h1>salesrecords</h1>
    <?php foreach($posts as $vaule) : ?>
    <div class="well">
        <h3><?php echo $vaule['size']; ?>
        </h3>
        <small>Created on <?php echo $vaule['color'];?> by <?php echo $vaule['price']; ?>
        </small>

        <p><?php echo $vaule['Description']; ?>

        </p>
</div>
</body>
</html>
j08691
  • 204,283
  • 31
  • 260
  • 272

1 Answers1

2

The error "unexpected end of file" means that when PHP was reading through your code, it was expecting to get to something, but never did. Often, it means you have mismatched brackets, quote marks, etc - you've indicated the start of something, and PHP is waiting for you to indicate the end.

In this case, you have a foreach(): which needs to be paired with an endforeach;

IMSoP
  • 89,526
  • 13
  • 117
  • 169