SitePoint Sponsor

User Tag List

Results 1 to 9 of 9

Threaded View

  1. #1
    SitePoint Member
    Join Date
    May 2013
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php mysql novice to ninja 5th edition

    php mysql novice to ninja 5th edition

    chapter 7

    After following the steps I keep getting the error:
    Warning: Invalid argument supplied for foreach() in /Applications/XAMPP/xamppfiles/htdocs/ijdb/admin/authors/authors.html.php on line 13

    Does anyone know where I went wrong or where the book went wrong, here's the code:

    PHP Code:
    <?php include_once $_SERVER['DOCUMENT_ROOT'] .
        
    '/ijdb/includes/helpers.inc.php'?>
    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="utf-8">
        <title>Manage Authors</title>
      </head>
      <body>
        <h1>Manage Authors</h1>
        <p><a href="?add">Add new author</a></p>
        <ul>
          <?php foreach ($authors as $author): ?>
            <li>
              <form action="" method="post">
                <div>
                  <?php htmlout($author['name']); ?>
                  <input type="hidden" name="id" value="<?php
                      
    echo $author['id']; ?>">
                  <input type="submit" name="action" value="Edit">
                  <input type="submit" name="action" value="Delete">
                </div>
              </form>
            </li>
          <?php endforeach; ?>
        </ul>
        <p><a href="..">Return to JMS home</a></p>
      </body>
    </html>
    Last edited by SpacePhoenix; May 16, 2013 at 22:49. Reason: placed php tags around php code


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •