Well i was doing so well, then i got stuck…
Oh, i do intend on creating a seperate file for all these database connections i’m making, for now i just want to get it working, i can tweak it all later on when i become a bit more competent.
Thanks
<?php
session_start();
// Are we logged in?
if (!isset($_SESSION['db_is_logged_in'])
|| $_SESSION['db_is_logged_in'] !== true) {
// If we're not logged in, piss off to the login page
header('Location: login.php');
exit;
}
// Connect to the database and run the query
$dbid = mysql_connect ('localhost', 'username, 'password');
mysql_select_db('database',$dbid)
or die ("Cannot find database");
$query = "SELECT * FROM request_data";
$result = mysql_query($query,$dbid)
or die("Select error:".mysql_error());
// Fetch the data from the selected table
while($r=mysql_fetch_array($result))
{
// Put the data from the query into the following variables
$req_id=$r["req_id"];
$manufacturer=$r["manufacturer"];
$model=$r["model"];
$capacity=$r["capacity"];
$year=$r["year"];
$part_one=$r["part_one"];
$part_two=$r["part_two"];
$part_three=$r["part_three"];
$part_four=$r["part_four"];
$part_five=$r["part_five"];
$full_name=$r["full_name"];
$telephone=$r["telephone"];
$alt_telephone=$r["alt_telephone"];
$email=$r["email"];
$contact_pref=$r["contact_pref"];
$area=$r["area"];
$timestamp=$r["timestamp"];
$comments=$r["comments"];
//display the row
// this is working so we know we just need to fix the tables
//echo "$req_id <br>";
}
?>
<html>
<head>
<title>Secure Area</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<!-- This is being commented out because it's not what we want -->
<!--<table width="600" height="100%">
<tr>
<td>Req ID</td><td>Manufacturer</td><td>Model</td><td>Capacity</td><td>Year</td>
<td>Part One</td><td>Part Two</td><td>Part Three</td><td>Part Four</td><td>Part Five</td>
<td>Name</td><td>Telephone</td><td>Alt Telephone</td><td>Email</td>
<td>Contact Pref</td><td>Area</td><td>TimeStamp</td><td>Comments</td>
</tr>
<tr>
<td><?php echo "$req_id" ?></td><td><?php echo "$manufacturer" ?></td><td><?php echo "$model" ?></td><td><?php echo "$capacity" ?></td><td><?php echo "$year" ?></td>
<td><?php echo "$part_one" ?></td><td><?php echo "$part_two" ?></td><td><?php echo "$part_three" ?></td><td><?php echo "$part_four" ?></td><td><?php echo "$part_five" ?></td>
<td><?php echo "$name" ?></td><td><?php echo "$telephone" ?></td><td><?php echo "$alt_telephone" ?></td><td><?php echo "$email" ?></td>
<td><?php echo "$contact_pref" ?></td><td><?php echo "$area" ?></td><td><?php echo "$timestamp" ?></td><td><?php echo "$comments" ?></td>
</tr>
</table>-->
<body>
<!--<p>This is where we will read the submissions and send them out. </p>-->
<p> </p>
<p><a href="logout.php">Logout</a> </p>
</body>
</html>