Alignment Error - HTML Tables - php

So I have this
<?php
$username = $_SESSION['username'];
$sql = mysql_query("SELECT * FROM `users` WHERE `username`='$username'");
while($row = mysql_fetch_array($sql))
{
$cash = $row['cash'];
$exp = $row['exp'];
$maxExp = $row['max_exp'];
$health = $row['health'];
$energy = $row['energy'];
$stanima = $row['stanima'];
$maxStanima = $row['max_stanima'];
$maxEnergy = $row['max_energy'];
?>
<div id="statsBox">
<table width="100%">
<tr>
<td width="2490px" height="20px">
<?php
echo '<b><font color="#00FF00" face="verdana">$'.$row['cash'].'</font></b>';
?>
</td>
<td width="5000px" height="20px">
<center>
<?php
echo '<b><font color="white" face="verdana">'.$energy.'/'.$maxEnergy.'</font></b>';
?>
</center></td>
<td width="2510px" height="20px">
<div class="right">
<?php
echo '<b><p class="White">'.$stanima.'/'.$maxStanima.'</p></b> ';
}
}
?>
</div>
</td>
</tr>
<div id="statsBox">
<table>
<tr>
<td width="2490px" height="20px">
<?php
echo '<b><font color="#00FF00" face="verdana">'.$health.'/100</font></b>';
?>
</td>
<td width="5000px" height="20px">
<center>
<?php
echo '<b><font color="white" face="verdana">'.$energy.'/'.$maxEnergy.'</font></b>';
?>
</center></td>
<td width="2510px" height="20px">
<div class="right">
<?php
echo '<b><p class="White">'.$stanima.'/'.$maxStanima.'</p></b> ';
?>
</td></tr>
</table>
</div>
</div>
</div>
I want the bottom 3 items to be moved up. Everything's inside 2 different tables. I've tried combining the tables but it messes up the alignment of the bottom middle item.
It's perfect how it is now, but I was wondering how I would decrease the table height somehow to make the bottom 3 items closer to the top?

in the second table, you can add class and specify its height in the css or simply add inline css in the second table
<table style="height:25px;">

Your need two Changes in your table
1. write a inline css in your table
<table width="100%" style="border-collapse: collapse;">
You need a inline css in your p tag in your td on both locations
<p class="White" style="margin:0px;"> </p>

Related

Print html table in pdf , many pdf to be generated

I have a page that is generated using data from a database into a table format.
Each result of a student is displayed on a page so that when printed on a printer, each result is printed on a page. I need now to generate a pdf for each student. How can I add code to generate the pdf, using the name of the student?
Thanks in advance.
<body>
<?php
$grade=7;
require 'GetStudentNames.php';
while ($row1 = $result1->fetch_assoc()) { ?>
<P style="page-break-before: always">
<table margin-top="70px" width="100%">
<tr>
<td rowspan="2"><img src="logo.PNG" alt="logo"></td>
<td style="text-align:center" rowspan="1">
<h2>xyz School</h2>
</td>
<tr>
<td rowspan="1" style="text-align: center; ">
<h3 style="text-decoration: underline ;text-align:center">Student Report Sheet - First Term 2021</h3>
</td>
</tr>
</table>
<?php echo '<br><table width="100%"><th width="50%">Student Name: '.#$row1["name"].' '.#$row1["firstname"].'</th>';
echo '</td>';
require 'db.php';
$sql = "select subject from results where SN = '".#$row1["sn"]."' order by listorder";
$result = $conn->query($sql);
$count=1;
while ($row = $result->fetch_assoc()) {
echo '<tr class="oneSubj"><td class="oneSubj">'. $count.'. '.#$row["subject"].'</td>
</tr>';
$count++;
}?>
</table>
<br>
<table style="width: 100%">
<th style="width:25%">Absences..................</th>
<br>
<h5 style="text-decoration: underline ;text-align:center">Special Mention</h5>
</table>
<?php }?>
</body>

Displaying submitted form results as a list of URL links

First of all my PHP skills are kinda limited, Hence my question to you here.
I have built a fairly complex form with multiple inputs(text boxs and drop downs) which are stored in a MYsql DB. When the form is submitted it displays on a new page as completed reports. These completed reports display one under the next every time the form is submitted. My question is, How can i get the reports displayed to show as a list of links to the individual reports rather then a list of complete reports.
I hope i've explained the situation well enough.
Code snippit from viewpage.php
<html>
<head>
<body>
<?php
mysql_connect("localhost","user","passwrd");
mysql_select_db("dtbase");
$order = "SELECT * FROM jobrequest" ;
$result = mysql_query($order);
while ($row=mysql_fetch_array($result)){
?>
<link rel="stylesheet" href="css/style.css" type="text/css" />
</head>
<body>
<div style="padding:15px 0px 0px 100px;">
<table cellpadding="0" cellspacing="0" border="0" style="vertical-align:middle;width: 1139px; background-color:#213568; height:36px;">
<tr>
<td class="topbar">Client Request Form</td>
<td style="width:900px;"></td>
<td class="topbar"><a style="color:#ffffff;" href="logout.php?logout">Logout</a></td>
</tr>
</table>
<div class="main-wrap">
<div class="content">
<table cellpadding="0" cellspacing="0" border="0" style="width: 1137px; background-color:#ffffff; height:5px;">
<tr>
<td></td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" >
<tr>
<td style="vertical-align:top; width:5px;"></td>
<td style="vertical-align:top;"><?php include("includes/clientchoices.php"); ?></td>
<td style="vertical-align:top; padding:0px 5px 15px 5px;">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td style="vertical-align:top; width:1002px;"> <h1> Dashboard</h1></td>
</tr>
<tr>
<td style="vertical-align:top; background-color:#f5f5f5;"><h2>Job Request Form</h2></td>
</tr>
<tr>
<td style="vertical-align:top; background-color:#ffffff; height:5px;"> </td>
</tr>
<tr>
<td>
<div class="form">
<table cellspacing="0" cellpadding="0" border="0" style="width:998px">
<tr>
<td style="width:1002px; border:solid 1px #000000; padding:10px 0px 10px 0px;"><center><img src="../../images/spectra_logotop.jpg" alt="Spectra" title="Spectra" width="735" height="120" style="padding:5px;"></center>
</td>
</tr>
<tr>
<td>
<div style="padding:10px 0px 10px 0px;">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="headingsa">Project Leader:</td><td class="answersa"><div class= "typesectiona"><?php echo ($row['project_leader'] ); ?></div></td>
<td class="headingsb">Contact Number:</td><td class="answersb"><div class= "typesectionb"><?php echo ($row['contact_number'] ); ?></div></td>
<td class="headingsc">Company Details:</td><td class="answersc"><div class= "typesectionc"><?php echo ($row['company_details'] ); ?></div></td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td>
<table cellpadding="0" cellspacing="0">
<tr>
<td class="headings5">Contact Person On Site:</td><td class="answers5"><div class= "typesection5"><?php echo ($row['contactperson_onsite'] ); ?></div></td>
<td class="headings6">Contact Details:</td><td class="answers6"><div class= "typesection6"><?php echo ($row['contact_no'] ); ?></div></td>
<td class="headings7">Date:</td><td class="answers7"><div class= "typesection7"><?php echo ($row['date'] ); ?></div></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table cellpadding="0" cellspacing="0">
<tr>
<td class="headings1">Job/Order Number:</td><td class="answers1"><div class= "typesection1"><?php echo ($row['job_order_number'] ); ?></div></td>
<td class="headings2">Document Number:</td><td class="answers2"><div class= "typesection2"><?php echo ($row['doument_number'] ); ?></div></td>
<td class="headings3">QCP:</td><td class="answers3"><div class= "typesection3"><?php echo ($row['qcp'] ); ?></div></td>
<td class="headings4">Page No:</td><td class="answers4"><div class= "typesection4"><?php echo ($row['pageno'] ); ?></div></td>
</tr>
</table>
</td>
</tr>
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="15px"></td>
<td><a class="othersubmitsLink" href="actionpdf.php">Email to Spectra</a></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
</div>
</div>
<?php
}
?>
</body>
</html>
You will need a separate PHP script for displaying a report based on a supplied ID. This separate script would look something like this:
Using mysqli
<?php
$conn = new mysqli("localhost", "user", "passwrd", "dtbase");
$jrQry = $conn->prepare("SELECT * FROM jobrequest WHERE jobrequest_id = ?");
$jrQry->bind_param('i', $_GET['jobrequest_id']);
$jrQry->execute();
$jobrequestResult = $jrQry->get_result();
$jobrequest = $jobrequestResult->fetch_assoc();
// At this point, $jobrequest will contain the jobrequest record you want to display.
?>
<!-- HTML FOR REPORT GOES HERE, USING $jobrequest VARIABLE TO SHOW THE DATA -->
Note that I have used mysqli in this example, if this is unsuitable you can use the old-style mysql commands, but for many many reasons (security chief among them) I would strongly suggest against this.
Using mysql
<?php
mysql_connect("localhost","user","passwrd");
mysql_select_db("dtbase");
$order = "SELECT * FROM jobrequest WHERE jobrequest_id = " . (int)$_GET['jobrequest_id'];
$result = mysql_query($order);
$jobrequest = mysql_fetch_array($result);
// At this point, $jobrequest will contain the jobrequest record you want to display.
?>
<!-- HTML FOR REPORT GOES HERE, USING $jobrequest VARIABLE TO SHOW THE DATA -->
Save this page as "viewjobrequest.php" and you will be able to load a given job request's report by supplying the jobrequest ID as a parameter in the URL, like so:
http://address_of_site/viewjobrequest.php?jobrequest_id=X
Now you can automatically generate a list of links to these pages by looking up your complete set of jobrequests and iterating over them, but instead on outputting a full report, just output a link:
Using mysqli
<?php
$conn = new mysqli("localhost", "user", "passwrd", "dtbase");
$jrQry = $conn->prepare("SELECT * FROM jobrequest WHERE jobrequest_id = ?");
$jrQry->bind_param('i', $_GET['jobrequest_id']);
$jrQry->execute();
$jobrequestResult = $jrQry->get_result();
?>
<ul>
<?php
while ($jobrequest = $jobrequestResult->fetch_assoc())
{
?>
<li>
<a href="viewjobrequest.php?jobrequest_id=<?php echo $jobrequest['jobrequest_id']; ?>">
View job request #<?php echo $jobrequest['jobrequest_id']; ?>
</a>
</li>
<?php
}
?>
</ul>
Using mysql
<?php
mysql_connect("localhost","user","passwrd");
mysql_select_db("dtbase");
$order = "SELECT * FROM jobrequest WHERE jobrequest_id = " . (int)$_GET['jobrequest_id'];
$result = mysql_query($order);
?>
<ul>
<?php
while ($jobrequest = mysql_fetch_assoc($result))
{
?>
<li>
<a href="viewjobrequest.php?jobrequest_id=<?php echo $jobrequest['jobrequest_id']; ?>">
View job request #<?php echo $jobrequest['jobrequest_id']; ?>
</a>
</li>
<?php
}
?>
</ul>
Note: I have deliberately omitted large portions of your HTML, you can add as much extra HTML as you need, I've just offered the bare bones to get you started.
BY looking at your code, I can say, it's not problem with PHP, it's more like HOW you are showing the result after fetching from database,
you are running loop, started from here
<?php while ($row=mysql_fetch_array($result)){ ?>
and ends here
<?php}?>
So everything inside loop or in easy words inside these brackets {} repeating again and again with new row of result fetched from database, if you take view source of viewpage.php you will see that style css file <link rel="stylesheet" href="css/style.css" type="text/css" /> repeating, Imagine if you are fetching 10 rows of result, you are also loading css file 10 times.
So the answer (most probably the solution) of your question is;
Your mysql query
<?php
mysql_connect("localhost","user","passwrd");
mysql_select_db("dtbase");
$order = "SELECT * FROM jobrequest" ;
$result = mysql_query($order);
$totalrows = mysql_num_rows($result); //Check Total Number of Rows To Check if Data Exist or Not
?>
and then in your HTML, First check if there are any rows exist in database which match your WHERE clause in mysql query.
//Set an if else statement here so incase if no data exist.
<?php if($totalrows > 0) {
//If row(s) exist run your while loop here
<?php while ($row=mysql_fetch_array($result)){ ?>
//Show the result here from database
//Close your loop
<?php } ?>
//Close your if condition
<?php } else { ?>
//Display a message here if there is no data to show
//Close your else bracket
<?php } ?>
With above explaniation I adjusted your HTML to show the result in desired way;
<table cellspacing="0" cellpadding="0" border="0" style="width:998px">
<tr>
<td style="width:1002px; border:solid 1px #000000; padding:10px 0px 10px 0px;"><center><img src="../../images/spectra_logotop.jpg" alt="Spectra" title="Spectra" width="735" height="120" style="padding:5px;"></center></td>
</tr>
<tr>
<td>
<?php if($totalrows > 0) {
<div style="padding:10px 0px 10px 0px;">
<table cellpadding="0" cellspacing="0">
<tr>
<td class="headingsa">Link to Report</td>
</tr>
<?php while ($row=mysql_fetch_array($result)){ ?>
<tr>
//You have to replace `nameoffile.php` with file in which you want to display report and correct this (as i assumed it) if it's wrong `$row['id']`
<td>Open Report</td>
</tr>
<?php } ?>
</table>
</div>
<?php } else { ?>
<div style="padding:10px 0px 10px 0px;">
<table cellpadding="0" cellspacing="0">
<tr>
<td>There is No Result To Show</td>
</tr>
</table>
</div>
<?php } ?>
</td>
</tr>
</table>
Note: MySQL will soon be deprecated, consider start using MYSQLi or PDO

mysql_fetch_array(), is not work in my program

i need to fetch multiple row or single row from mysql table, but my code retrieve data from table only multiple rows as given in my where clause condition is true, not fetch single row even my condition is true. plz suggest me anyone. (i know only little bit english)
<?php
include 'connection/db_connection.php';
$sqlquery=mysql_query("select * from sadmin_invoiceno order by sno desc");
$row1=mysql_fetch_assoc($sqlquery);
$invoice=$row1['invoice_no'];
/* if($row1['invoice_no']<=9)
{
$myvalue=$row1['invoice_no'];
$idvalue="".$myvalue;
}
if($row1['invoice_no']>9 && $row1['sno']<100)
{
$myvalue=$row1['invoice_no'];
$idvalue="".$myvalue;
} */
$sql="SELECT * FROM sadmin_sales where invoice_no='".$invoice."'";
$result = mysql_query($sql);
$count=mysql_num_rows($result);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>IT Flower invoice</title>
<link rel="stylesheet" href="assets/css/style_popup.css" media="all" />
<link href="assets/css/utopia-white.css" rel="stylesheet">
</head>
<body>
<div class="invoice">
<header class="clearfix">
<div id="logo">
<img src="assets/img/utopia-logo1.png">
</div>
<div id="company">
<h2 class="name">Indian Traditional Flowers</h2>
<div>10 - 3500 McNicoll Ave., <br>Toronto, Ontario ON M1V 4c7</div>
<div>+1.647.836.9999</div>
<div>info#itflowers.com</div>
</div>
</header>
<main>
<div id="details" class="clearfix">
<div id="client">
<div class="to">INVOICE TO:</div>
<h2 class="name"><?php
$sql2=mysql_query("SELECT franchies, customer FROM sadmin_sales where invoice_no='".$invoice."'");
$res1=mysql_fetch_array($sql2);echo $res1['customer'];
$franchies= $res1['franchies'];
$sql3=mysql_query("SELECT * FROM sadmin_customer where email='".$franchies."'");
$res2=mysql_fetch_array($sql3);
echo $res2['shop_name'];
?></h2>
<div class="address"> <?php echo $res2['owner_name']; ?> </div>
<div class="address"><?php echo $res2['address']; ?></div>
<div class="email"><?php echo $res2['email']; ?></div>
<div class="email"><?php echo $res2['phone']; ?></div>
</div>
<div id="invoice">
<h1>INVOICE NO: <?php echo $invoice; ?></h1>
<div class="date">Date of Invoice: <?php echo $date = date('d/m/Y h:i:s a'); ; ?></div>
</div>
</div>
<table class="inventory" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr style="text-align: center;">
<th class="no">#</th>
<th class="desc">DESCRIPTION</th>
<th class="unit">UNIT PRICE</th>
<th class="qty">QUANTITY</th>
<th class="total">TOTAL</th>
</tr>
</thead>
<tbody>
<tr>
<?php
$tax=0;
$ship=0;
$paid=0;
$bal=0;
$grand=0;
$sum=0;
for($i=1; $i<$count;)
{
while($row = mysql_fetch_array($result))
{
$franchies = $row['franchies'];
echo "<td class='no'>".$i."</td> ";
echo "<td class='desc'>" . $row['product_name'] . "</td>";
echo "<td class='unit'>" . $row['unit_price'] . "</td>";
echo "<td class='qty'>" . $row['quantity'] . "</td>";
echo "<td class='total' >".$row['total']."</td>";
echo "</tr>";
$sum=$sum + $row['total'];
$i++;
//$tax=$sum *.13;
$include=$row['tax_type'];
if ($include =='includetax')
{
$tax1=mysql_query("select * from sadmin_tax where tax_type like 'include%'");
$res1=mysql_fetch_array($tax1);
$tax2=$res1['percentage'];
$tax=$sum * $tax2/100;
$sum1=$sum - $tax;
}
else
{
$tax3=mysql_query("select * from sadmin_tax where tax_type like 'exclude%'");
$res3=mysql_fetch_array($tax3);
$tax4=$res3['percentage'];
$tax=$sum * $tax4/100;
$sum1=$sum + $tax;
}
$ship=$row['shipping_amt'];
$paid=$row['paid_amt'];
$grand=$sum1 + $ship;
$bal=$grand - $paid;
}
}
?>
</tbody>
<tfoot>
<tr>
<td colspan="2"></td>
<td colspan="2">SUBTOTAL</td>
<td>$ <?php echo $sum; ?></td>
</tr>
<tr>
<td colspan="2"></td>
<td colspan="2">TAX 13%</td>
<td>$ <?php echo $tax; ?></td>
</tr>
<tr>
<td colspan="2"></td>
<td colspan="2">SHIP</td>
<td>$<?php echo $ship; ?></td>
</tr>
<tr>
<td colspan="2"></td>
<td colspan="2">PAID</td>
<td>$<?php echo $paid; ?></td>
</tr>
<tr>
<td colspan="2"></td>
<td colspan="2">BALANCE</td>
<td>$<?php echo $bal; ?></td>
</tr>
<tr>
<td colspan="2"></td>
<td colspan="2">GRAND TOTAL</td>
<td>$<?php echo $grand; ?></td>
</tr>
</tfoot>
</table>
<button onclick="myFunction()" class="btn btn-primary" style="width: 106px;float: right;">Print this page</button>
<!-- <div id="thanks">Thank you!</div>
<div id="notices">
<div>NOTICE:</div>
<div class="notice">A finance charge of 1.5% will be made on unpaid balances after 30 days.</div>
</div>
</main>
<footer>
Invoice was created on a computer and is valid without the signature and seal.
</footer> -->
</div>
<script>
function myFunction() {
window.print();
}
</script>
</body>
</html>
I'm not certain I understand your question fully, are you saying you have multitple rows but only want one?
If so , check out MySQL "LIMIT " which will limit your SQL query to X number of rows, such as SELECT * FROM sadmin_customer where email='".$franchies." LIMIT 1
This will return only 1 row, the first row where the conditions are true.

PHP - product comparison table displaying only one column

I am trying to compare products and display results in a table. I have a form page and a TABLE page, the problem is that when i select in the FORM page from the two drop-downs the same product(value) it will only display in the table one column and returns an multidimensional array containing one array not two arrays identical. When i select two different values from the from and submit, both selections are displayed. How can I avoid having one empty column if the user select the same product /ID ?
I was thinking maybe load the second drop down and subtracting from the list the value of the first drop down selection? I am not sure how to do it Or maybe there is an easier way like a form validation. Can someone show me how? Thanks
FORM.html
<?php
$products_dropdown = "select * from product_dp" ;
$statement = $dbh->prepare($products_dropdown);
$statement->execute();
$result_dp = $statement->fetchAll();?>
<form action="table.html" method="post">
<fieldset class="custimg">
<legend>Product Comparison</legend>
<div class="row">
<div class="large-block-grid-4"><br /></div>
<div class="large-block-grid-4">
<select name="id1" id="id1" class="small button secondary dropdown radius">`
<?php foreach ($result_dp as $row){
echo "<option value='".$row['id']."'>".$row['sku']."</option>";}?>
</select>
</div>
<div class="large-block-grid-4">
<select name="id2" id="id2" class="small button secondary dropdown radius">
<?php foreach ($result_dp as $row){
echo "<option value='".$row['id']."'>".$row['sku']."</option>"; }?>
</select>
<input type="submit" value="Compare" class="tiny button secondary" />
</div>
</div>
Table.html
$id1 = $_POST[id1];
$id2 = $_POST[id2];
$statement = $dbh->prepare("select * from products_specs where id IN ($id1,$id2)");
$statement->execute(array(':id1' => $id1, ':id2'=> $id2));
$statement->setFetchMode(PDO::FETCH_ASSOC);
$subrows = $statement->fetchAll();
print_r($subrows);
$yes = '<img src="images/icons/yes.png" width="16" height="16" />';
$no = '<img src="images/icons/no.png" width="16" height="16" />';?>
<table >
<thead>
<tr>
<th width="100"></th>
<th width="275"><?php echo $subrows[0][image]; ?></th>
<th width="275"><?php echo $subrows[1][image]; ?></th>
</tr>
<tr text-align="center">
<th width="100"></th>
<th class="centered-cell1"><font color="#990000"><?php echo "ID"." ".$subrows[0][id]; ?></th>
<th class="centered-cell1"><font color="#990000"><?php echo "ID"." ".$subrows[1][id]; ?></th>
</tr>
</thead>
<tbody>
<tr>
<td > Capacity </td>
<td align="center"><?php echo $subrows[0][capacity]; ?> </td>
<td align="center"><?php echo $subrows[1][capacity]; ?> </td>
</tr>
<tr>
<td > Memory </td>
<td align="center"><?php echo $subrows[0][mem]; ?> </td>
<td align="center"><?php echo $subrows[1][mem]; ?> </td>
</tr>
ect....
Very simple solution. After executing query use code:
if (!isset($subrows[1]))
$subrows[1] = $subrows[0];
Let users compare a product with itself if they want it.

Displaying Records in Multiple Columns Using PHP

I'm trying to display two (2) columns instead of my current one (1) column.
My example here:
http://freeskateboardsticker.com/news/authors.php
I have rewritten the script many times, but I cannot seem to get the rows and columns to display correctly and still keep the pagination intact.
Below is my script:
<?php include_once(realpath("templates/top.php")); ?>
<?php include_once(realpath("templates/$templates/mid1.php")); ?>
<?php
$page = #$_GET["page"];
$start = #$_GET["start"];
if (!is_numeric($page) || $page < 1)
$page = 1;
if ($page == 1)
$start = 0;
else
$start = ($page * $authorsPerPage) - $authorsPerPage;
$aResult = mysql_query("select pk_alId, alEmail, alFName, alLName, alBio, alDateJoined from tbl_AdminLogins order by alFName, alLName limit $start, $authorsPerPage");
$numRows = mysql_num_rows(mysql_query("select pk_alId from tbl_AdminLogins order by alFName, alLName"));
if ($numRows > 0) {
?>
<!-- Start Authors -->
<div align="center">
<center>
<TABLE WIDTH="86%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
<TR>
<TD WIDTH="100%" HEIGHT="20" COLSPAN="2" ALIGN="right" class="BodyText" VALIGN="top"><FONT COLOR="#0B75AF"> <?PHP
if ($page > 1)
$nav .= "<a href='authors.php?page=" . ($page - 1) . "'><span class='Link1'><u>« Prev</u></span></a> | ";
for ($i = 1; $i <= ceil($numRows / $authorsPerPage); $i++)
if ($i == $page)
$nav .= "<a href='authors.php?page=$i'><span class='Link4'><b>$i</b></span></a> | ";
else
$nav .= "<a href='authors.php?page=$i'><span class='Link1'>$i</span></a> | ";
if (($start + $authorsPerPage) < $numRows && $numRows > 0)
$nav .= "<a href='authors.php?page=" . ($page + 1) . "'><span class='Link1'><u>Next »</u></span></a>";
if (substr(strrev($nav), 0, 2) == " |")
$nav = substr($nav, 0, strlen($nav) - 2);
echo $nav . "<br> ";
?></FONT>
</TD>
</TR>
</TABLE>
<?php while ($aRow = mysql_fetch_array($aResult)) { ?>
<div align="center"><center>
<TABLE WIDTH="720" CELLSPACING="0" CELLPADDING="0" BORDER="0">
<TR>
<TD WIDTH="185"> <?php if ($showAuthorImages) { ?><img src="imageview.php?what=getAuthorPic&authorId=<?php echo $aRow["pk_alId"]; ?>"> <?php } ?></TD>
<TD WIDTH="5" VALIGN="top"> </TD>
<TD WIDTH="530" VALIGN="MIDDLE"><SPAN CLASS="BodyHeading1"><?PHP echo $aRow["alFName"]; ?></SPAN>
<BR><span class="Text1"><?php echo $aRow["alBio"]; ?></span><br></TD>
</TR>
<TR>
<TD COLSPAN="3"> </TD>
</TR>
</TABLE>
</center></div>
<?php } ?>
<div align="center">
<center>
<table width="96%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" height="20" colspan="2" align="right" valign="top">
<SPAN CLASS="Text4"><?php echo $nav . "<br> "; ?></SPAN>
<br>
</td>
</tr>
</table>
</center>
</div>
<!-- End Authors -->
<?php
} else {
// No authors found in the database
?>
<!-- StartAuthors -->
<div align="center">
<center>
<table width="96%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" colspan="2" bgcolor="#FFFFFF" height="21">
<span class="BodyHeading">
<br>No Authors Found
</span>
<span class="Text1">
<br><br>
No authors were found in the database. Please use
the link below to return to our home page.
<br><br>
</span>
Return Home
</td>
</tr>
</table>
</center>
</div>
<!-- End Authors -->
<?php
}
?>
Do not use font tag, it is deprecated
br /> not br>
If you are writing then write all other tags also in lower case
Use some MySQLi library (PDO etc)
Do not put center and div with align center tag into while cycle
Build table rows in while cycle, not one table per one author (table beginning before while, table ending after while cycle, inside while leave onl tr/td generation)
Move your loop inside the table, to create a new row per iteration, not a new table:
<div align="center">
<center>
<TABLE WIDTH="720" CELLSPACING="0" CELLPADDING="0" BORDER="0">
<?php while ($aRow = mysql_fetch_array($aResult)) { ?>
<TR>
<TD WIDTH="185"> <?php if ($showAuthorImages) { ?><img src="imageview.php?what=getAuthorPic&authorId=<?php echo $aRow["pk_alId"]; ?>"> <?php } ?></TD>
<TD WIDTH="5" VALIGN="top"> </TD>
<TD WIDTH="530" VALIGN="MIDDLE"><SPAN CLASS="BodyHeading1"><?PHP echo $aRow["alFName"]; ?></SPAN>
<BR><span class="Text1"><?php echo $aRow["alBio"]; ?></span><br></TD>
</TR>
<TR>
<TD COLSPAN="3"> </TD>
</TR>
<?php } ?>
</TABLE>
</center>
</div>

Categories