paddy086
asked on
html php table fit over screen but keep all tables in aliment
Hi
Well first of all I have attached a picture of the way the table looks.
My issue is I used
Is there a way to link Absent teacher_5 table and Absent teacher_6 table look more aligned
But still use the full size of the screen thanks
Or is there a way to keep the first box Absent teacher,subject,class,room ,cover all in alignment and let Period1 to 9 stretch
Well first of all I have attached a picture of the way the table looks.
My issue is I used
<table width="90%" table border="3" style="border-width: 1px; border-color:#000000;
>>> border-style: solid;">
To make my table stretch over the webpage but the issue is if the first table has small names in it the table stretches the first box double the size and it makes the table’s aliment look all over the place.Is there a way to link Absent teacher_5 table and Absent teacher_6 table look more aligned
But still use the full size of the screen thanks
Or is there a way to keep the first box Absent teacher,subject,class,room
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Absent Teachers</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="styles.css" />
<script type="text/javascript">var start = new Date();start = Date.parse(start)/1000;var seconds = 10;function CountDown(){ var now = new Date(); now = Date.parse(now)/1000; var counter = parseInt(seconds-(now-start),10); document.getElementById('countdown').innerHTML = counter; if(counter > 0){ timerID = setTimeout("CountDown()", 100) }else{ location.href = "http://localhost/tables3of5.php" }}window.setTimeout('CountDown()',100);</script>
</head>
<body>
<div id="container">
<div id="header"> <img name="Logo" src="images/logo.png" width="233" height="76" alt=""></div>
</DIV>
<div id="navigation1">
<p> </p>
<p>You will be redirected in <center><strong id="countdown">10</strong> seconds.</center></p>
<p><center>
<img src="images/ajax-loader.gif" width="16" height="11"></center></p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> <?php
error_reporting(E_ALL);
// CONNECTION AND SELECTION VARIABLES FOR THE DATABASE
$db_host = "localhost";
$db_name = "test";
$db_user = "root";
$db_word = "mypassword";
// OPEN A CONNECTION TO THE DATA BASE SERVER
// MAN PAGE: http://php.net/manual/en/function.mysql-connect.php
if (!$db_connection = mysql_connect("$db_host", "$db_user", "$db_word"))
{
$errmsg = mysql_errno() . ' ' . mysql_error();
echo "<br/>NO DB CONNECTION: ";
echo "<br/> $errmsg <br/>";
}
// SELECT THE MYSQL DATA BASE
// MAN PAGE: http://php.net/manual/en/function.mysql-select-db.php
if (!$db_sel = mysql_select_db($db_name, $db_connection))
{
$errmsg = mysql_errno() . ' ' . mysql_error();
echo "<br/>NO DB SELECTION: ";
echo "<br/> $errmsg <br/>";
die('NO DATA BASE');
}
// IF WE GOT THIS FAR WE CAN DO QUERIES
// GET THE LIST OF TABLES
$sql = "SHOW TABLES";
$res = mysql_query($sql) or die("FAIL: $sql <br/>" . mysql_error() );
// CREATE AN ARRAY OF TABLE NAMES
$tables = array();
while ($row = mysql_fetch_array($res))
{
$tables[] = $row[0];
}
// GET THE COUNT OF TABLES
$total = count($tables);
// TEST EACH TABLE FOR ROWS OF DATA
$used = 0;
foreach ($tables as $table)
{
if ($table!="class" && $table!="room" && $table!="student" && $table!="subject" && $table!="teacher" && $table!="users") {
$sql = "SELECT * FROM $table LIMIT 1";
$res = mysql_query($sql) or die("FAIL: $sql <br/>" . mysql_error() );
$num = mysql_num_rows($res);
if ($num) $used++;
}
}
// SHOW THE WORK PRODUCT
echo "There are $used Absent Teachers";
?> </p>
</div>
<?php
/*
This is an example showing how to list records as hyperlink
and associated key data/variables.
*/
// Connect to server
// Replace username and password by your details
$db = @mysql_connect("localhost","root","mypassword");
if (!$db)
{
do_error("Could not connect to the server");
}
// Connect to the database
// Note that your database will be called username
@mysql_select_db("test",$db)or do_error("Could not connect to the database");
// Run the search query
$result = mysql_query("SELECT * FROM sick5 ORDER BY period5",$db);
if(mysql_num_rows($result)) :
//create an empty array for each row - ready to take 8 values.
for ($period5=1; $period5 < 10; $period5++) {
$sickteacher5[$period5] = null;
$subject5[$period5] = null;
$class5[$period5] = null;
$room5[$period5] = null;
$coverteacher5[$period5] = null;
}
//loop through the data result and build the row data.
while ($myrow = mysql_fetch_array($result)) {
$sickteacher5[$myrow['period5']] = $myrow['sickteacher5'];
$subject5[$myrow['period5']] = $myrow['subject5'];
$class5[$myrow['period5']] = $myrow['class5'];
$room5[$myrow['period5']] = $myrow['room5'];
$coverteacher5[$myrow['period5']] = $myrow['coverteacher5'];
}
?>
<table width="90%" table border="3" style="border-width: 1px; border-color:#000000;
>>> border-style: solid;">
<tr>
<th>Absent Teacher_5</th><th>Period1</th><th>Period2</th><th>Period3</th><th>Period4</th><th>Period5</th><th>Period6</th><th>Period7</th><th>Period8</th><th>Period9</th></tr>
<tr><th>Absent Teacher</th><?php foreach ($sickteacher5 as $period5 => $teacher5) { printf("<td>%s</td>",$teacher5); } ?></tr>
<tr><th>Subject</th><?php foreach ($subject5 as $period5 => $subject5) { printf("<td>%s</td>",$subject5); } ?></tr>
<tr><th>Class</th><?php foreach ($class5 as $period5 => $class5) { printf("<td>%s</td>",$class5); } ?></tr>
<tr><th>Room</th><?php foreach ($room5 as $period5 => $room5) { printf("<td>%s</td>",$room5); } ?></tr>
<tr><th>Cover Teacher</th><?php foreach ($coverteacher5 as $period5 => $teacher5) { printf("<td>%s</td>",$teacher5); } ?></tr>
</table>
<br><center> </center><br>
<?php else: ?>
<p>No Records Found Of Absent Teacher_5</p>
<?php header('Refresh: 01; URL=http://localhost/tables3of5.php'); // New URL ?>
<?php endif; ?>
<?php
$result = mysql_query("SELECT * FROM sick6 ORDER BY period6",$db);
if(mysql_num_rows($result)) :
//create an empty array for each row - ready to take 8 values.
for ($period6=1; $period6 < 10; $period6++) {
$sickteacher6[$period6] = null;
$subject6[$period6] = null;
$class6[$period6] = null;
$room6[$period6] = null;
$coverteacher6[$period6] = null;
}
//loop through the data result and build the row data.
while ($myrow = mysql_fetch_array($result)) {
$sickteacher6[$myrow['period6']] = $myrow['sickteacher6'];
$subject6[$myrow['period6']] = $myrow['subject6'];
$class6[$myrow['period6']] = $myrow['class6'];
$room6[$myrow['period6']] = $myrow['room6'];
$coverteacher6[$myrow['period6']] = $myrow['coverteacher6'];
}
?>
<table width="90%" table border="3" style="border-width: 1px; border-color:#000000;
>>> border-style: solid;">
<tr>
<th>Absent Teacher_6</th><th>Period1</th><th>Period2</th><th>Period3</th><th>Period4</th><th>Period5</th><th>Period6</th><th>Period7</th><th>Period8</th><th>Period9</th></tr>
<tr><th>Absent Teacher</th><?php foreach ($sickteacher6 as $period5 => $teacher6) { printf("<td>%s</td>",$teacher6); } ?></tr>
<tr><th>Subject</th><?php foreach ($subject6 as $period6 => $subject6) { printf("<td>%s</td>",$subject6); } ?></tr>
<tr><th>Class</th><?php foreach ($class6 as $period6 => $class6) { printf("<td>%s</td>",$class6); } ?></tr>
<tr><th>Room</th><?php foreach ($room6 as $period6 => $room6) { printf("<td>%s</td>",$room6); } ?></tr>
<tr><th>Cover Teacher</th><?php foreach ($coverteacher6 as $period6 => $teacher6) { printf("<td>%s</td>",$teacher6); } ?></tr>
</table>
<br><center> </center><br>
<?php else: ?>
<p>No Records Found Of Absent Teacher_6</p>
<?php endif; ?>
<?php
$result = mysql_query("SELECT * FROM sick7 ORDER BY period7",$db);
if(mysql_num_rows($result)) :
//create an empty array for each row - ready to take 8 values.
for ($period7=1; $period7 < 10; $period7++) {
$sickteacher7[$period7] = null;
$subject7[$period7] = null;
$class7[$period7] = null;
$room7[$period7] = null;
$coverteacher7[$period7] = null;
}
//loop through the data result and build the row data.
while ($myrow = mysql_fetch_array($result)) {
$sickteacher7[$myrow['period7']] = $myrow['sickteacher7'];
$subject7[$myrow['period7']] = $myrow['subject7'];
$class7[$myrow['period7']] = $myrow['class7'];
$room7[$myrow['period7']] = $myrow['room7'];
$coverteacher7[$myrow['period7']] = $myrow['coverteacher7'];
}
?>
<table border="3" style="border-width: 1px; border-color:#000000;
>>> border-style: solid;">
<tr>
<th>Absent Teacher_7</th><th>Period1</th><th>Period2</th><th>Period3</th><th>Period4</th><th>Period5</th><th>Period6</th><th>Period7</th><th>Period8</th><th>Period9</th></tr>
<tr><th>Absent Teacher</th><?php foreach ($sickteacher7 as $period7 => $teacher7) { printf("<td>%s</td>",$teacher7); } ?></tr>
<tr><th>Subject</th><?php foreach ($subject7 as $period7 => $subject7) { printf("<td>%s</td>",$subject7); } ?></tr>
<tr><th>Class</th><?php foreach ($class7 as $period7 => $class7) { printf("<td>%s</td>",$class7); } ?></tr>
<tr><th>Room</th><?php foreach ($room7 as $period7 => $room7) { printf("<td>%s</td>",$room7); } ?></tr>
<tr><th>Cover Teacher</th><?php foreach ($coverteacher7 as $period7 => $teacher7) { printf("<td>%s</td>",$teacher7); } ?></tr>
</table>
<br><center> </center><br>
<?php else: ?>
<p>No Records Found Of Absent Teacher_7</p>
<?php endif; ?>
<?php
$result = mysql_query("SELECT * FROM sick8 ORDER BY period8",$db);
if(mysql_num_rows($result)) :
//create an empty array for each row - ready to take 8 values.
for ($period8=1; $period8 < 10; $period8++) {
$sickteacher8[$period8] = null;
$subject8[$period8] = null;
$class8[$period8] = null;
$room8[$period8] = null;
$coverteacher8[$period8] = null;
}
//loop through the data result and build the row data.
while ($myrow = mysql_fetch_array($result)) {
$sickteacher8[$myrow['period8']] = $myrow['sickteacher8'];
$subject8[$myrow['period8']] = $myrow['subject8'];
$class8[$myrow['period8']] = $myrow['class8'];
$room8[$myrow['period8']] = $myrow['room8'];
$coverteacher8[$myrow['period8']] = $myrow['coverteacher8'];
}
?>
<table border="3" style="border-width: 1px; border-color:#000000;
>>> border-style: solid;">
<tr>
<th>Absent Teacher_8</th><th>Period1</th><th>Period2</th><th>Period3</th><th>Period4</th><th>Period5</th><th>Period6</th><th>Period7</th><th>Period8</th><th>Period9</th></tr>
<tr><th>Absent Teacher</th><?php foreach ($sickteacher8 as $period8 => $teacher8) { printf("<td>%s</td>",$teacher8); } ?></tr>
<tr><th>Subject</th><?php foreach ($subject8 as $period8 => $subject8) { printf("<td>%s</td>",$subject8); } ?></tr>
<tr><th>Class</th><?php foreach ($class8 as $period8 => $class8) { printf("<td>%s</td>",$class8); } ?></tr>
<tr><th>Room</th><?php foreach ($room8 as $period8 => $room8) { printf("<td>%s</td>",$room8); } ?></tr>
<tr><th>Cover Teacher</th><?php foreach ($coverteacher8 as $period8 => $teacher8) { printf("<td>%s</td>",$teacher8); } ?></tr>
</table>
<br><center> </center><br>
<?php else: ?>
<p>No Records Found Of Absent Teacher_8</p>
<?php endif; ?>
</body>
<div id="wrapper"></div>
<div id="footer">
<p>my site</p>
<p>xcxcxcxcxcxcxcxcxcx</p>
</div>
</div>
</body>
</html>
table-size.png
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
I need to see 'php.php' file, as it has form inside. Also, I need to see a screenshot of the issue.
ASKER
fixed the issue thanks lightspeedvt but if you want to try your test your self have a look at my other post please ID: 38886324
thanks
thanks