Location: PHPKode > projects > XMasDB > xmasdb/list.php
<?php
// start the session
session_start();

// is the one accessing this page logged in or not?
if (!isset($_SESSION['basic_is_logged_in']) 
    || $_SESSION['basic_is_logged_in'] !== true) {

    // not logged in, move to login page
    header('Location: index.php');
    exit;
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<style type="text/css">@import url("style.css");</style>
<title>X-Mas Gift Database</title>
</head>
<body>
<h2>X-Mas Gift Database</h2>

<p align="center">
<input type="button" class="btn" onClick="window.location='new.php'" value="New Gift"> &nbsp; &nbsp; 
<input type="button" class="btn" onClick="window.location='export.php'" value="Export to MS Excel"> &nbsp;&nbsp;
<input type="button" class="btn" onClick="window.location='about.php'" value="About"> &nbsp;&nbsp;
<input type="button" class="btn" onClick="window.location='logout.php'" value="Logout"></p><br>

<p align="center">
<table style="width: 650;" border="1" cellpadding="3" cellspacing="0">
  <tbody>
    <tr>
      <td width="120"><b>Name</b></td>
      <td width="350"><b>Gift</b></td>
	<td width="70"><b>Got It?</b></td>
	  <td width="110"><b>&nbsp;</b></td>
    </tr>

<?php
include 'config.php';
include 'lib/opendb.php';


$query = "SELECT id, name, gift, got FROM gifts ORDER by name";
$result = mysql_query($query);

while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
$id=$row["id"];
	    echo "<tr><td>{$row['name']}</td>
		  <td>{$row['gift']}</td>
		  <td>{$row['got']}</td>
		  <td><input type=\"button\" class=\"btn\" onClick=\"window.location='modify.php?id=$id'\" value=\"Update\"> <input type=\"button\" class=\"btn\" onClick=\"window.location='delete.php?cmd=delete&amp;id=$id'\" value=\"X\"></td></tr>";
 
} 
include 'lib/closedb.php';
?> 

</tbody>
</table>
</body>
</html>
Return current item: XMasDB