I have successfully created log in and log out page..when the user success to log in using their username and password they will go to the view page but unfortunately the view page doesn't show out data in database mysql and also no error come out on that coding..
This is my viewpage.php
<html>
<?php
include("authenticationStaff.php");
include ("dbase.php");
?>
<body>
<table width="869" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="645" height="50" align="left" valign="middle"><strong>Welcome , You log in as <?php echo $_SESSION['SESS_STAFF_NAME'];?>
<td width="377" align="right" valign="middle"><strong>Log Out</strong></td>
</tr>
</table>
</center>
<?php
$query= "SELECT s.staff_id,s.staff_name,i.project_name,i.location,i.cost,i.pic,i.detail,i.file_name,i.file_type,i.file_size,i.file_content,i.staff_id
FROM staff s
JOIN inter1 i
on(s.staff_id = i.staff_id)
WHERE i.staff_id = '".$_SESSION['SESS_ID']."'";
$result = mysql_query($query);
?>
<tr>
<td colspan="4" align="left" valign="top" class="horizon_divider"><p> </p>
</td><td width="750" valign="top"><div align="center">
<h3>DATA</h3>
<table width="836" border="2" align="center" style= "background-color: #FFFFFF; color: #000000; margin: 0 auto;" >
<thead>
<tr bgcolor="#FFFFFF">
<th width="142">PROJECT NAME</th>
<th width="114">LOCATON</th>
<th width="94">COST</th>
<th width="151">PERSON IN CHARGE</th>
<th width="187">DETAIL</th>
<th width="187">ATTACHMENT</th>
<th width="88">ACTION</th>
</tr>
</thead>
<tbody>
<?php
while( $row = mysql_fetch_assoc( $result ) ){
echo
"<tr>
<td>{$row['project_name']}</td>
<td>{$row['location']}</td>
<td>{$row['cost']}</td>
<td>{$row['pic']}</td>
<td>{$row['detail']}</td>
<td></td>
<td><a href='editStaff.php?id={$row ['staff_id']}'>ADD NEW RECORD</a>||<a href='deleteStaff.php?id={$row ['staff_id']}'>DELETE</a></td> </tr> ";
}
?>
</tbody>
</table>
</table>
</body>
</html>
Can someone see where I am going wrong?if you need any more info then please let me know. thanks.
Related
Output of the PDF file
I am generating PDF file using TCTDF. I am fetching data from table in TCPDF.
I want to connect the table in flow but I am getting the output like attached image. I am trying but its not working. When I start $htmlcontent without closing the table tag for 2nd code it also showing error. Even CSS is not working for margin between two tables
$htmlcontent ='
<html>
<head>
<meta http-equiv="Content-Language" content="hi">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
td{
height: 8px;
}
</style>
</head>
<body>
<!-- ============================== Logo and address ================================= -->
<table class="table table-hover" border="0" cellpadding="8" cellspacing="0">
<tr>
<td>
<center>
<img src="../assests/images/order_logo.gif" height="75" width="150"/>
</center>
</td>
<td style="text-align:right;">
<p><strong style="font-size: 12px; color:#245580;">SCS Technology</strong><br/>
The Address, Koregaon Park, <br/>
Pune, Maharashtra 411001<br/>
<strong>Mobile: </strong> +91 9988776655<br/>
<strong>Email: </strong> company#domain.com<br/>
</p>
</td>
</tr>
</table>
<p style="border-top: 2px solid #eb8b8b;"></p>
<!-- ============================== Customer name and address ================================= -->
<table class="table table-hover" border="0" cellpadding="8" cellspacing="0">
<tr>
<td style="text-align:left;">
<p><strong style="font-size: 12px; color:#245580;">INVOICE TO:</strong><br/><br/>
<strong style="font-size: 12px;">'.$clientName.'</strong><br/>
<strong>Mobile: </strong> '.$clientContact.'<br/>
</p>
</td>
<td>
<table class="table table-hover" border="0" cellpadding="5" cellspacing="0">
<tr colspan="2">
<th> </th>
<th>Order No : '.$clientName.'</th>
</tr>
<tr colspan="2">
<th> </th>
<th>Invoice Date : '.$orderDate.'</th>
</tr>
<tr colspan="2">
<th> </th>
<th>GST No : APSG6656SRT</th>
</tr>
</table>
</td>
</tr>
</table>
<p style="border-top: 2px solid #eb8b8b;"></p>
<br /><br />
<!-- ============================== Order Information ================================= -->
<table class="table table-hover" border="1" cellpadding="8" cellspacing="0">
<tr>
<th colspan="5" style="text-align:center; background-color:#eb8b8b; font-weight:bold;">Order Details</th>
</tr>
<tr style="text-align:center; background-color:#d9edf7; font-weight:bold;">
<th width="10%">No</th>
<th width="45%">Description</th>
<th width="15%">Price</th>
<th width="15%">Quantity</th>
<th width="15%">Total Price</th>
</tr>
</table>
';
$pdf->writeHTML($htmlcontent, true, false, false, false, '');
$orderItemSql = "SELECT order_item.product_id, order_item.rate, order_item.quantity, order_item.total,
product.product_name FROM order_item
INNER JOIN product ON order_item.product_id = product.product_id
WHERE order_item.order_id = $orderId";
//$orderItemResult = $connect->query($orderItemSql);
$order = mysqli_query($con, $orderItemSql);
$i=0;
while ($orderData1 = mysqli_fetch_array($order)) {
$product_name = $orderData1['product_name'];
$order_quantity = $orderData1['quantity'];
$order_rate = $orderData1['rate'];
$order_total = $orderData1['total'];
$i++;
$htmlcontent ='
<table class="table table-hover" border="1" cellpadding="8" cellspacing="0" style="margin-top:-20px !important;">
<tr>
<td width="10%">'.$i.'</td>
<td width="45%">'.$product_name.'</td>
<td width="15%">'.$order_quantity.'</td>
<td width="15%">'.$order_rate.'</td>
<td width="15%">'.$order_total.'</td>
</tr>
</table>
';
$pdf->writeHTML($htmlcontent, true, false, false, false, '');
}
$htmlcontent ='
<table class="table table-hover" border="1" cellpadding="8" cellspacing="0" style="margin-top:-20px !important;">
<tr>
<td width="85%" style="text-align:right; font-weight:bold;">Sub Total</td>
<td width="15%">'.$subTotal.'</td>
</tr>
<tr>
<td width="85%" style="text-align:right; font-weight:bold;">Discount</td>
<td width="15%">'.$discount.'</td>
</tr>
<tr>
<td width="85%" style="text-align:right; font-weight:bold;">GST 18%</td>
<td width="15%">'.$gstn.'</td>
</tr>
<tr>
<td width="85%" style="text-align:right; font-weight:bold;">Total</td>
<td width="15%">'.$grandTotal.'</td>
</tr>
</table>
<br /><br />
</body>
</html>
<p style="border-top: 2px solid #eb8b8b;"></p>
';
$pdf->writeHTML($htmlcontent, true, false, false, false, '');
//------------------------------------------------------
}
}
The second parameter to writeHTML controls whether a new line should be added. Setting it to false should do the trick:
$pdf->writeHTML($htmlcontent, false, false, false, false, '');
^^^^^
I want to convert html file into pdf using mpdf class. working well but the count > 30 the page rotating no display ,
<?php
include("connection.php");
$phase=mysql_query("select * from session where status=1");
$phasee = mysql_fetch_array($phase);
$mindate = $phasee['st_date'];
$maxdate = $phasee['end_date'];
$query_omr = mysql_query("SELECT * from sit_details a,staff_details b where b.staff_code=a.staff_code and a.val_center=".$_GET['num']);
$staffrowdet = mysql_fetch_array($query_omr);
$query_exam_session = mysql_query("SELECT * from exam_session");
$row_exam_session = mysql_fetch_array($query_exam_session);
$randm=rand(100001,999999);
$text_page='
<style>
table {
width:1000px;
font-family:Times New Roman, Times;
border-collapse: collapse;
text-align:justify;
padding:2px;
font-size:12px;
text-transform: uppercase;
}
td, th {
height:30px;
text-transform: uppercase;
padding:2px;
}
</style>
<table id="simple-table" >
<tr><td colspan="2">
<table>
<tr>
<td rowspan="3"><img src="assets/images/logo.gif" width="80px" /></td>
<td align="center" style="font-size:20px"><strong>Heading1 </strong></td>
</tr>
<tr>
<td align="center" style="font-size:16px"><strong>Heading2 - '. $row_exam_session['session'].' </strong> </td>
</tr>
<tr>
<td align="center" style="font-size:14px"><strong>DETAIL</strong></td>
</tr>
</table>
</td></tr>
<tr><td colspan="2">
<table id="dynamic-table" class="table table-striped table-bordered table-hover" width="900" align="left">
<tr>
<th colspan="6" style="font-size:14px" align="left">PERIOD : FROM <u>'.$mindate .' </u> TO <u>'.$maxdate.' </u> </th>
</tr>
<div style="width:50px;height:50px;border:1px solid #000;"></div>
</table>
</td></tr>
<tr>
<td>
<strong><caption> Form Details</caption> </strong>
<table id="dynamic-table" class="table table-striped table-bordered table-hover" border="1" style="page-break-inside: avoid"> <tr bgcolor="#CCCCCC" >
<th align="center" width="50px"><label class="control-label bolder blue">Sl.No </label></th>
<th align="center" width="100px"><label class="control-label bolder blue">Staff ID </label></th>
<th align="left" width="100px"><label class="control-label bolder blue"> Staff Name</label></th>
<th align="left" width="100px"><label class="control-label bolder blue"> Designation </label></th>
</tr>';
$c1=0;
while($row_dummy = mysql_fetch_array($query_omr)) {
$text_page=$text_page.'
<tr>
<td align="center"><h3>'. $c1 .'</h3></td>
<td align="center"><h3>'. $row_dummy['staff_code'].'</h3></td>
<td align="left"><h3>'. $row_dummy['staff_name'].'</h3></td>
<td align="left"><h3>'. $row_dummy['staff_designation'].'</h3></td>
</tr>';
$c1++;
}
$text_page=$text_page.'
<tr>
<table >
</tr>
</table>
</table>
</td>
</tr>
<table id="dynamic-table" class="table table-striped table-bordered table-hover" border="1" width="800" >
<tbody>
<tr>
<th align="center" width="300px" ></th> <br/>
<th align="center" width="150px">Post Held</th>
<th align="center" width="250px">Name</th>
<th align="center" width="50px">Signature</th>
</tr>
<tr>
<td> </td>
<td align="center" height="70"><strong> <br/> Officer / <br/> Coordinator </strong> </td>
<td height="70"></td>
</tr>
<tbody>
<td align="right" width="300px" valign="bottom" rowspan="2" > </td>
</table>
</table>
<table>
<tr><td align="left"><h4>'.$randm.'</h4></td><td align="right"><h4>'.date('d-m-Y H:i:s').'</h4></td></tr>
</table>
';
//echo $text_page;
//exit;
ob_end_clean();
ini_set('memory_limit', '500000M');
include("MPDF57/mpdf.php");
//$mpdf = new mPDF('c', 'A4-L','0', '0', '10', '10','10', '10');
$mpdf = new mPDF(
'', // mode - default ''
'A4', // format - A4, for example, default ''
0, // font size - default 0
'', // default font family
10, // margin_left
10, // margin right
5, // margin top
0, // margin bottom
5, // margin header
5, // margin footer
'P' // L - landscape, P - portrait
);
$mpdf->autoPageBreak = true;
$mpdf->AddPage();
$fname=$_GET['num'].".pdf";
$mpdf->SetWatermarkImage('assets/images/logo.jpg');
$mpdf->setFooter('{PAGENO}');
$mpdf->showWatermarkImage = true;
$mpdf->WriteHTML($text_page);
$mpdf->Output($fname, 'D');
exit;
?>
the pdf downloaded, but the count<30 if the rowcount>30 the page not responding. how to solve this error. i cannot find out the solution. kindly suggest any other mpdf sample program which is matching my requirement.
I'm creating a table where width of last 3 columns don't change by the values which i set, here is how it looks like in picture:
Programavimo darbas row's last columns size should be one 71 second 11 and last 17. But they are not.
What am i doing wrong, they all are the same even if their sizes are different. Ive tried putting width into style but still the same. Help please! And here is my html code:
<table width="100%" cellspacing="1" cellpadding="4" border="0" class="tbl">
<th style="width: 10%;"><?php echo $AppUI->_('Task type'); ?></th>
<th style="width: 10%;"><?php echo $AppUI->_('Task quantity'); ?></th><!--Užduočių kiekis-->
<th style="width: 10%;"><?php echo $AppUI->_('All time'); ?></th><!--Visas laikas-->
<th style="width: 10%;"><?php echo $AppUI->_('Average'); ?></th><!--Visas laikas-->
<th colspan="3" style="width: 60%;"><?php echo $AppUI->_('In time/Due time'); ?></th><!--Vidurkis per užduotį-->
<?php
if (!empty($taskqu)) {
foreach ($taskqu as $key => $value) {
echo "<tr>";
echo "
<td>{$task_types[$key]}</td>
<td>{$taskqu[$key]['viso_tasku']}</td>
<td>{$taskqu[$key]['viso_valandu']}</td>
<td>{$taskqu[$key]['vidurkis']}</td>
<td style='width: {$taskqu[$key]['viso_pabaigti']}%; background: springgreen; text-align: center;'>comp</td>
<td style='width: {$taskqu[$key]['laiku']}%; background: aquamarine; text-align: center;'>laik</td>
<td style='width: {$taskqu[$key]['veluojama']}%; background: tomato; text-align: center;'>vel</td>";
echo "</tr>";
}
?>
</table>
hIs this what you are trying to achieve with your last few columns?
<table width="100%" border="1">
<thead>
<th style="width:10%;">th1</th>
<th style="width:10%;">th2</th>
<th style="width:10%;">th3</th>
<th style="width:10%;">th4</th>
<th style="width:60%;">th5</th>
</thead>
<tbody>
<tr>
<td>td1</td>
<td>td2</td>
<td>td3</td>
<td>td4</td>
<td>
<table width="100%" border="1" style="background-color:yellow;">
<tr>
<td style="width:71%;">1</td>
<td style="width:11%;">2</td>
<td style="width:17%;">3</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>td1</td>
<td>td2</td>
<td>td3</td>
<td>td4</td>
<td>
<table width="100%" border="1" style="background-color:green;">
<tr>
<td style="width:61%;">1</td>
<td style="width:6%;">2</td>
<td style="width:32%;">3</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>td1</td>
<td>td2</td>
<td>td3</td>
<td>td4</td>
<td>
<table width="100%" border="1" style="background-color:red;">
<tr>
<td style="width:18%;">1</td>
<td style="width:11%;">2</td>
<td style="width:71%;">3</td>
</tr>
</table>
</td>
</tr>
</tbody>
</table>
There are a few issues that might cause:
There's no <tr> tag after the <table> tag.
You may use <col> tags in the way described below.
Columns
Try using <col> tags:
<table width="100%" cellspacing="1" cellpadding="4" border="0" class="tbl">
<col width="10%">
<col width="10%">
<col width="10%">
<col width="10%">
<col width="60%">
<tr>
<th style="width: 10%;"><?php echo $AppUI->_('Task type'); ?></th>
<th style="width: 10%;"><?php echo $AppUI->_('Task quantity'); ?></th><!--Užduočių kiekis-->
<th style="width: 10%;"><?php echo $AppUI->_('All time'); ?></th><!--Visas laikas-->
<th style="width: 10%;"><?php echo $AppUI->_('Average'); ?></th><!--Visas laikas-->
<th colspan="3" style="width: 60%;"><?php echo $AppUI->_('In time/Due time'); ?></th><!--Vidurkis per užduotį-->
</tr>
<!-- -->
</table>
I'm working on a php/mysql application and need to make the output of one column, one row an html link to another html page. Have not been able to find any relavant information. The "" needs to be the link. Thanks for any help.
<table id="display" style="width:800px;">
<tr>
<th width="40">ID</th>
<th width="70">Last</th>
<th width="70">First</th>
<th width="10">Middle</th>
<th width="70">Birth</th>
<th width="70">Death</th>
<th width="170">Notes</th>
<th width="100">Cemetery</th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td style='text-align:center;'><?=$objResult["id"];?></td>
<td style='text-align:center;'><?=$objResult["last"];?></td>
<td style='text-align:center;'><?=$objResult["first"];?></td>
<td style='text-align:center;'><?=$objResult["middle"];?></td>
<td style='text-align:center;'><?=$objResult["birth"];?></td>
<td style='text-align:center;'><?=$objResult["death"];?></td>
<td><?=$objResult["notes"];?></td>
<td style='text-align:center;'><?=$objResult["cemetery"];?></td>
</tr>
<?
}
?>
</table>
I can final exams assignment of lecturers to create a website forum.
and now there is a problem in my coding.
please fix.
when creating a topic / thread, and we opened the topic / threadnya, there is a date that tell us when the topic / thread made.
but in my coding, showing all existing date in the database.
<?php
session_start();
if($_SESSION['logged'] == true)
{
if(isset($_SESSION['username']))
{ echo $username=$_SESSION["username"];
}else
{
header('Location:login.php');
}
}
?>
<!DOCTYPE html>
<html>
<head>
<!==CSS>
<style>
#clock{
pointer-events: none
}
</style>
<!close css>
<img src="head1.jpg" alt="icon" width="100%" height="110">
<img src="line1.jpg" alt="icon" width="100%" height="20">
<title>Venray</title>
<body background="alienbackground.jpg">
<font face="comic sans MS">
<!==Table Login==>
<table border="0" style="width:99%" bgcolor="#424242" align="center">
<tr>
<table border="0" style="width:98%" bgcolor="#424242" align="center">
<tr>
<td> <img src="start.gif" alt="icon" width="26" height="26"> </td>
<td rowspan="2" align="right">
<table border="0" bgcolor="#2E2E2E">
<tr>
<td><b>
<?php
{
echo "<tr><td><b><font color=green> Welcome, ";
echo $username;
echo '<span>, [Log Out]</span></li>';
echo "</tr></td></b></font>";
}
?>
</b></td>
</tr>
<tr>
<td id=clock align="right"><b><iframe src="http://free.timeanddate.com/clock/i4eh41xm/n108/tlsg/fn7/fs12/tct/pct/ftb/tt0/tw1/tm1/th1" frameborder="0" width="182" height="20" allowTransparency="true"></iframe>
</b></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top"><b><font size="4">Community</font></b></td>
</tr>
</table>
</tr>
<p style="color:#ff0000">
<!==Table please welcome==>
<table border="0" style="width:98%" bgcolor="#424242" align="center">
<tr>
<td align="right">
<?php
error_reporting(E_ALL ^ E_DEPRECATED);
require("conn.php");
$con = mysql_connect($server,$user,$pass);
$db = mysql_select_db($db);
$sql = "select * from d_admin order by username";
//echo $sql;
$ambil_data = mysql_query($sql);
while($data = mysql_fetch_array($ambil_data))
$result = mysql_query("SELECT * FROM d_admin");
$rows = mysql_num_rows($result);
echo "Member " . $rows . " * ";
?>
Post 1 * Topics 1 </td>
</tr>
</table>
<br>
<table border="1" width="98%" height="6%" align="center" bgcolor=#424242 >
<tr>
<td align="left" ><img src="hometopic.gif" width="40" height="40"> </td>
</tr>
<tr>
<table border="1" width="98%" height="40" align="center" bgcolor="#86B404" bordercolor=green>
<tr>
<th width="70%" align="left"><img src="open.png" width="40" height="40">Posting Display</th>
<td align="right"><img src="replay.png" width="150" height="40"></td>
</tr>
</tr>
<tr>
<table border="1" width="98%" height="70" align="center" bgcolor=#424242>
***<?php
error_reporting(E_ALL ^ E_DEPRECATED);
$con = mysql_connect($server,$user,$pass);
$db = mysql_select_db($db);
$sql = "select * from tabel_topik ";
$ambil_data = mysql_query($sql);
while($data = mysql_fetch_array($ambil_data))
{
echo '<tr><th align="left" valign="top" colspan="2" >'.$data['date'].'</th></tr>';
echo '</tr>';
}
?>***
<tr><th align="center" width="15%">Venray</th><td align="left" width="85%">title</td></tr>
<tr><th align="top" width="15%">join dates</th><td align="left" rowspan="2" valign="top">awd</td></tr>
<tr><th align="center" valign="top" width="15%" height="400">9 Post</th></tr>
<tr>
<td align="left">*</td>
<td align="right" width="85%"><img src="replay.png" width="150" height="40"></td></tr>
</table>
</tr>
</table>
</body>
</font>
</head>
</html>
Get forum specific datas by passing the ID or any similar field in the query for starters. Then if you are looking to format the way in which the date is displayed, you could use the php date function like this:
while($data = mysql_fetch_array($ambil_data))
{
echo '<tr><th align="left" valign="top" colspan="2" >'.date('jS M, Y',strtotime($data['date'])).'</th></tr>'; //format the date as required
echo '</tr>';
}