...

View Full Version : Setting a work area



hans_cellc
10-23-2012, 08:43 AM
I have my code below and it works perfectly in listing the content of a database. My problem is that I have a CODE link at the bottom of the page that opens a new window to display the page code (Not standard I know but for assignment purposes).
The problem I am experiencing is that the database listing goes over this link.
Is there a way to set a frame or boundary for this not to happen, without using frames.

My Code:

<?php

require "config.php";
require "connect_db.php";

?>

<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>List Page - 48323934 - ICT 2613</title>
<meta name="Description" content="PHP ICT2613 Exam Assignment. 48323934 - List Page" />
<meta http-equiv="content-language" content="en-za" />
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="Author" content="S.J. Fouche, Student number: 48323934" />
<meta name="HandheldFriendly" content="True" />
<!-- Link to the external style sheet (CSS) -->
<link rel="stylesheet" type="text/css" href="my_css.css" />
<!-- Link to the external javascript file -->
<script type="text/javascript" src="my_javascript.js"></script>

</head>

<body">
<!-- Used the include feature for the header and links on all pages -->
<?PHP
// Check, if user is already login, then jump to secured page
if(!loggedin()) {
// Set header
require "header.txt";
// Check, if user is logged, if if not give warning to login in first
echo ("<script type='text/javascript'>
window.alert('You are not logged in, please log in or register to view this page.')
window.location.href='index.php';
</script>");
}
else {
require "header_secure.txt";
}

echo "<h2 align='center'>List of Games</h2><br />";

// Set the Query and to order by?
$query = "SELECT * FROM tb_list ORDER BY gamename";

// Create a if statement to check if results returned and if not to display an error
if($query_run = mysql_query($query)) {
if(mysql_num_rows($query_run) == NULL) {
echo "No Results Found";
}
else {
// Set the table and headers outside the loop
echo "<table width='95%' border='1'><tr align='center' bgcolor='#eeffee'><th>Game Name</th><th>Type</th><th>Platform</th>
<th>Zone</th><th>Manufacturer</th><th>Price</th><th colspan='2'>Action</th></tr>";

while($query_row = mysql_fetch_assoc($query_run)) {
$game_id = $query_row['game_id'];
$gamename = $query_row['gamename'];
$type = $query_row['type'];
$platform = $query_row['platform'];
$zone = $query_row['zone'];
$manufact = $query_row['manufact'];
$price = $query_row['price'];

echo "<tr align='center'><td>$gamename</td><td>$type</td><td>$platform</td><td>$zone</td><td>$manufact</td><td>$price</td><td><a href=edit.php?game_id=$game_id&update=yes>Edit</a></td>
<td><a href=delete.php?game_id=$game_id&delete=yes>Delete</a></td></tr>";
// echo $game_id. str_repeat("&nbsp;", 5). $gamename. str_repeat("&nbsp;", 5). $type. str_repeat("&nbsp;", 5). $platform. str_repeat("&nbsp;", 5). $zone. str_repeat("&nbsp;", 5). $manufact. str_repeat("&nbsp;", 5). $price. "<br />";
}
echo "</table>";
}
}
else {
echo mysql_error();
}

?>


<!-- PHP Coding -->
<?PHP
// Code below will create Code link at the center and bottom of the page
echo("<p style='position:absolute; z-index: 0; bottom:5px; left:49%;'><a href='javascript: listcode()'>Code</a></p>")
?>

</body>
</html>

davidjones1990
10-23-2012, 11:55 PM
Sounds like its a CSS problem, i think its because you are using position absolute on that last paragraph

hans_cellc
10-24-2012, 08:07 AM
I know that is the reason, I changed to realational and it was solved but the if database is short it appears at top just below last entry. Is there not a way to set the last few pixels out of bounds for the ormal page content.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum