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>
Related
maybe the subject is duplicate or have the similarity with others, but i haven't found what i'm looking for.
I have a Sales Order table on sql, and I am using odbc to connect
id_sales_order date customer product qty
001 2017-12-12 ABC laptop 1
001 2017-12-12 ABC printer 1
001 2017-12-12 ABC mouse 2
002 2017-12-15 Hercules pc 1
002 2017-12-15 Hercules hdd 1
and I have a code
<body>
<?php
$konek = odbc_connect("otosurabaya","mike","mike") or die("Error Connect to Database");
$sql = "SELECT id_sales_order, customer, product, date,qty FROM Kreasi_Cabang.dbo.QNota_SalesOrder where sales='" .$_SESSION['username']. "' group by id_sales_order, customer, product, date, qty" ;
$hasil = odbc_exec($konek, $sql) or die ("Error Execute [".$sql."]");
$noUrut = 1;
?>
<?php
while($result = odbc_fetch_array($hasil))
{
?>
<div class="panel panel-success">
<div class="panel-heading" >
<h3 class="panel-title" align="center"><strong> <?php echo $_SESSION['username']; ?> </strong> </h3>
</div>
<div class="panel-body">
<table width="100%" border="1">
<tr>
<th width="131" scope="row">Customer</th>
<td width="44">:</td>
<td width="800" align="left"><?php echo $result['customer'];?></td>
</tr>
<tr>
<th scope="row">SO ID</th>
<td>:</td>
<td align="left"><?php echo $result['id_sales_order'];?></td>
</tr>
<tr>
<th scope="row">Date
<td align="left"><?php echo $result['date'];?></td>
</tr>
<tr>
<th height="49" scope="row">Product</th>
<td> </td>
<td align="left">QTY</td>
</tr>
<tr>
<th scope="row"><?php echo $result['product'];?></th>
<td> </td>
<td align="left"><?php echo $result['qty'];?></td>
</tr>
<?php }?>
</table>
</p>
</div>
<hr />
<?php
odbc_close($konek);
?>
</body>
The above code, it display record only per row, I want to remove the same value and keep the others.
I have search and try many syntax, please need your expertise
I want to display the record as below
Customer : ABC
Date : 2017-12-12
ID SO : 001
Product QTY
Laptop 1
Printer 1
Mouse 1
You need to put the if condition inside the while loop. And need to put the flag so that your customer name and other details should be print once and uniquely.
And product details will be print multiple times. Here is the code for that:
<?php
$customer_name = '';
$sale_date = '';
$sales_id = '';
$flag = true;
?>
<div class="panel panel-success">
<div class="panel-heading" >
<h3 class="panel-title" align="center"><strong> <?php echo $_SESSION['username']; ?> </strong> </h3>
</div>
<div class="panel-body">
<table width="100%" border="1">
<?php
while($result = odbc_fetch_array($hasil))
{
?>
<?php if($customer_name != $result['customer'] && $sale_date != $result['date'] && $sales_id != $result['id_sales_order']) { ?>
<tr>
<th width="131" scope="row">Customer</th>
<td width="44">:</td>
<td width="800" align="left"><?php echo $result['customer'];?></td>
</tr>
<tr>
<th scope="row">SO ID</th>
<td>:</td>
<td align="left"><?php echo $result['id_sales_order'];?></td>
</tr>
<tr>
<th scope="row">Date
<td align="left"><?php echo $result['date'];?></td>
</tr>
<?php
$customer_name = $result['customer'];
$sale_date = $result['date'];
$sales_id = $result['id_sales_order'];
$flag = true;
} else { $flag = false; }
if($flag) {
?>
<tr>
<th height="49" scope="row">Product</th>
<td> </td>
<td align="left">QTY</td>
</tr>
<?php } ?>
<tr>
<th scope="row"><?php echo $result['product'];?></th>
<td> </td>
<td align="left"><?php echo $result['qty'];?></td>
</tr>
<?php } ?>
You can change in the if condition && with || if you want to print the customer details in case of any detail is not matching. Like if date is different or if sales id is different.
Note: I put the if condition on the basis of your data shown in question. you can change it as per your requirement.
<?php session_start();
require_once('SessionSet.php');
require_once('connection.php');
include('top.php');
if(isset($_GET['ClassID']) && isset($_GET['SectionId']) )
{
$ClassID = $_GET['ClassID'];
$SectionId = $_GET['SectionId'];
$ClassName = $_GET['ClassName'];
$SectionName = $_GET['SectionName'];
$GetCurrentMonth = date('M');
/* select latest Academic Year*/
$GetAcademicQ = "select * from study_year order by StudyYearId desc limit 1";
$GetAcademicQR = mysqli_query($con,$GetAcademicQ);
$GetAcademicRow = mysqli_fetch_assoc($GetAcademicQR);
$AcademciyearId = $GetAcademicRow['StudyYearId'];
$YearName = $GetAcademicRow['YearName'];
/* Get Students and Students Class + Fee Records */
$GetStudentClassQ = "select * from studentclass where
AcademicYearId='$AcademciyearId' and StudentClassId='$ClassID'
and StudentSectionId='$SectionId';";
$GetStudentClassQR = mysqli_query($con,$GetStudentClassQ);
$GetStudentClassNum = mysqli_num_rows($GetStudentClassQR);
if($GetStudentClassNum>0)
{
while($GetStudentClassRow = mysqli_fetch_assoc($GetStudentClassQR))
{
$StudentID = $GetStudentClassRow['StudentID'];
$RollNumber = $GetStudentClassRow['RollNumber'];
$RollNumber = $GetStudentClassRow['RollNumber'];
$StuentClassFee = $GetStudentClassRow['StuentClassFee'];
/* Get Stduent Name and bio data */
$GetStudentQ = "select * from students where Student_ID='$StudentID';";
$GetStudentQR = mysqli_query($con,$GetStudentQ);
$GetStudentRow = mysqli_fetch_assoc($GetStudentQR);
$Name = $GetStudentRow['Name'];
$FatherName = $GetStudentRow['FatherName'];
$StudentPhoto = $GetStudentRow['StudentPhoto'];
$Student_ID = $GetStudentRow['Student_ID'];
/* Get Stduent Name and bio data */
$GetfeeQ = "select * from fee where FeeStudentID='$StudentID';";
$GetfeeQR = mysqli_query($con,$GetfeeQ);
$GetfeeRow = mysqli_fetch_assoc($GetfeeQR);
$FeeAmount = $GetfeeRow['FeeAmount'];
$FeePaid = $GetfeeRow['FeePaid'];
?>
<div id="page-wrapper">
<div class="container-fluid">
<div class="row">
<table class="table table-hover table-bordered print-table" style="width:100% !important" align="center">
<!--Office Copy-->
<tr class="warning">
<th>Student ID</th>
<td>
<?php echo $Student_ID;?>
</td>
<th>Class</th>
<td>
<?php echo $ClassName;?>
</td>
<th>Section Name</th>
<td>
<?php echo $SectionName;?>
</td>
<th>Roll Number</th>
<td>
<?php echo $RollNumber;?>
</td>
<th>Academic Year </th>
<td>
<?php echo $YearName;?>
</td>
<!--td rowspan="5" style="text-align:center"><img src="StudentImages/<?php/* echo $StudentPhoto;*/?>"/ alt="Stdudent Image not found" style="width:150px; height:200px"></td-->
</tr>
<tr class="warning">
<th>Student Name</th>
<td colspan="4">
<?php echo $Name;?>
</td>
<th>Father Name</th>
<td colspan="4">
<?php echo $FatherName;?>
</td>
</tr>
<tr class="warning">
<th>Fee Month </th>
<td>
<?php echo $GetCurrentMonth;?>
</td>
<th>Fee Amount</th>
<td style="font-size:20px;">
<?php echo $StuentClassFee;?>
</td>
<th>Previous Dues</th>
<td style="font-size:20px;">
<?php echo $FeeAmount-$FeePaid;?>
</td>
<th>Due Date</th>
<td>12 -
<?php echo $GetCurrentMonth;?>
</td>
<th>After Due Date</th>
<td>
<?php echo $StuentClassFee+50;?>
</td>
</tr>
<hr>
<!--Student Copy-->
</table>
<table class="table table-hover table-bordered print-table" style="width:100% !important" align="center" >
<tr class="warning">
<th>Student ID</th>
<td>
<?php echo $Student_ID;?>
</td>
<th>Class</th>
<td>
<?php echo $ClassName;?>
</td>
<th>Section Name</th>
<td>
<?php echo $SectionName;?>
</td>
<th>Roll Number</th>
<td>
<?php echo $RollNumber;?>
</td>
<th>Academic Year </th>
<td>
<?php echo $YearName;?>
</td>
<!--td rowspan="5" style="text-align:center"><img src="StudentImages/<?php/* echo $StudentPhoto;*/?>"/ alt="Stdudent Image not found" style="width:150px; height:200px"></td-->
</tr>
<tr class="warning">
<th>Student Name</th>
<td>
<?php echo $Name;?>
</td>
<th>Father Name</th>
<td>
<?php echo $FatherName;?>
</td>
<th>Fee Month </th>
<td>
<?php echo $GetCurrentMonth;?>
</td>
<th>Fee Amount</th>
<td style="font-size:20px;">
<?php echo $StuentClassFee;?>
</td>
<th>Previous Dues</th>
<td style="font-size:20px;">
<?php echo $FeeAmount-$FeePaid;?>
</td>
</tr>
</table>
</div>
<!-- row end here -->
</div>
</div>
<!-- page-wrapper end here -->
<?php
}
}
else
{
}
?>
<?php
}
?>
i am building a php school management application. when I try to print report after pressing ctrl+p one recored is being shown on each page. but i want to show atleast 3 records on a single page after giving printing command. I have attached snapshots of records before and after print command.
enter image description here
here is picture after giving print command
enter image description here
Your question has nothing to do with PHP, this is a question about CSS, specifically print styles.
In the absence of an example of plain HTML and CSS, take a look at the CSS properties page-break-before, page-break-after and page-break-inside. In this case you may want to look at something like:
#media print {
.row, table {
page-break-before: avoid;
page-break-after: avoid;
}
}
Learn a little bit more about the page-break-* properties at this CSS Tricks article. If you are generally new to CSS print styles, I wrote a primer for .NET magazine.
Bear in mind that whatever styles you use, these are only suggestions to the browser. Paper size, page orientation, font size, zoom level, user margins, etc. will all work together to mess with your plans. Content that you force to be too wide for the page may also be an issue.
Finally, don't use any inline styles. Use your CSS file for that (so get rid of that width:100% inline style I saw.
If you want more help, post the raw HTML output and your CSS.
I am having problems trying to get my system to count the number of times a files has been downloaded. The website has download buttons linking to the files which are stored on my database, and I would like to be able to count the amount of downloads per file to display as a statistic, ideally once they click the link to download, the column in the files table should be incremented,but i cant do that. i'm beginner in php. somebody can help me?this is my code to display the file.
<h3 class="box-title">Senarai Borang Cuti</h3>
<p> </p>
</div><!-- /.box-header -->
<div class="box-body">
<!-- Advanced Tables -->
<div class="table-responsive">
<?php
$raw_results = mysql_query("SELECT * FROM document WHERE doc_jenisfail= 'Cuti';");
?>
<table width="98%" class="table table-striped" id="dataTables-example">
<thead>
<table width="600" border="1">
<tr>
<th width="190" bgcolor="#756E37"class="sw" style="text-align: centre" scope="col">Tajuk Borang</th>
<th width="30" bgcolor="#756E37" class="sw" style="text-align: centre" scope="col">Tarikh Upload</th>
<th width="30" bgcolor="#756E37" class="sw" style="text-align: centre" scope="col">Memuat Turun</th>
</tr>
</thead>
<tbody>
<?php
while($results = mysql_fetch_array($raw_results)) { ?>
<tr>
<td align="left"><?php echo $results['nama_file'];?></td>
<td align="center"><?php echo $results['tanggal_upload'];?></td>
<td align="center"><img src="images/download.png?key=<?php $results['nama_file'] ?>" /></td>
</tr>
<?php } ?>
</tbody>
</table>
</p></td>
You can add +1 to downloads in your database and then redirect to file.
In your template use link like download.php?id=1, for downloading file with id 1.
Download.php Code:
<?php
//name of file: download.php
$id = $_GET['id'];
//Check if the get number is really a number
if (ctype_digit($id)) {
//Add +1 to downloads
mysql_query("update `document` set `downloads`=`downloads`+1 where id='$id'") or die(mysql_error());
//Redirect to downloads
$download_file = mysql_fetch_array(mysql_query("select * from document where id='$id'")) or mysql_error();
header("Location: http://example.com/pdfs/$download_file[name].pdf");
} else {
echo 'Wrong link';
}
?>
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
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>