when i use this method, the heading of table is horizontal, not the vertical heading.
$link= mysqli_connect($host, $user, $pass, $db);
if (isset($_GET['eid']))
{
$eid=$_GET['eid'];
}
$output = '';
$count=0;
$sql = "SELECT * FROM event_record where eventID='{$eid}' ";
$result = mysqli_query($link, $sql);
while($row = mysqli_fetch_array($result))
{
$count++;
$output .= "<tr>
<td>$count</td>
<td>{$row['studentID']}</td>
<td>{$row['studentName']}</td>
<td>{$row['contact']}</td>
<td>{$row['program']}</td>
<td>{$row['booking_date']}</td>
<td>{$row['booking_type']}</td>
</tr>
";
}
return $output;
i want the result of the pdf is , the table heading is at the vertical and at the left side, not horizontal.
<table class="table table-bordered">
<tr>
<th width="3%">No.</th>
<th width="10%">Student ID</th>
<th width="10%">Student Name</th>
<th width="10%">Contact</th>
<th width="5%">Program</th>
<th width="8%">Booking Date</th>
<th width="10%">Booking Type</th>
</tr>
<?php
echo fetch_data();
?>
</table>
Below code is merge the value and the table heading
<table border="1" cellspacing="0" cellpadding="3">
<tr>
<th width="5%">No.</th>
<th width="15%">Student ID</th>
<th width="20%">Student Name</th>
<th width="15%">Contact</th>
<th width="10%">Program</th>
<th width="15%">Booking Date</th>
<th width="15%">Booking Type</th>
</tr>
';
$content .= fetch_data();
$content .= '</table>';
$obj_pdf->writeHTML($content);
$obj_pdf->Output('file.pdf', 'I');
I need a result like this,
Related
So in this query below im joining two tables through order_id and displaying the all the values from the user_orders table.
As per the image below I am trying to display only the order_Id rows that match the order_manager table.
public function getUserOrder(){
$sql = "SELECT user_orders.order_id,
user_orders.title, user_orders.price,
user_orders.quantity
FROM order_manager
JOIN user_orders ON order_manager.order_id = user_orders.order_id;";
$stmt = $this->connect()->prepare($sql);
$stmt->execute();
while ($result = $stmt->fetchAll()){
return $result;
}
}
I have attempted to use an if statement that appears to do something however it gives me the values that don't match order id in reverse.
<div class="container mt-5">
<?php $artworks = new Artworks(); ?>
<div class="row">
<div class="col-lg-12">
<table class="table table-dark">
<thead>
<tr>
<th scope="col">Order ID</th>
<th scope="col">Full Name</th>
<th scope="col">Phone</th>
<th scope="col">Address</th>
<th scope="col">Orders</th>
</tr>
</thead>
<?php
$artworks->getOrder();
foreach ($artworks->getOrder() as $art) {
echo "<tbody>
<tr>
<td>$art[order_id]</td>
<td> $art[full_name]</td>
<td> $art[phone] </td>
<td>$art[address]</td>
<td>
<table class= 'tale text-center table-dark'>
<thead>
<tr>
<th scope='col'>Order ID</th>
<th scope='col'>title</th>
<th scope='col'>price</th>
<th scope='col'>Quantity</th>
</tr>
<thead>
<tbody>
<tr>";
$artworks->getUserOrder();
foreach ($artworks->getUserOrder() as $order) {
if ($order['order_id'] == $art['order_id']) {
echo "<td>$order[order_id]</td>";
}
echo "
<td>$order[title]</td>
<td>$order[price]</td>
<td>$order[quantity]</td>
</tr>";
}
echo "
</tbody>
</table>
</td>
</tr>
";
}
?>
</tbody>
</table>
</div>
</div>
</div>
Here is an image to help explain the desired output
Solved moving the td items into the if statement. Guess it was mostly correct.
$artworks->getUserOrder();
foreach($artworks->getUserOrder() as $order)
{
if ($order['order_id'] == $art['order_id']) {
echo "<td>$order[order_id]</td>";
echo "
<td>$order[title]</td>
<td>$order[price]</td>
<td>$order[quantity]</td>
</tr>
";
}
}
I have problem for show array data from Oracle Database to table HTML.
This is the query :
$sql ="SELECT A.AC,A.CREATED_BY,A.SCHEDULE_COMPLETION_DATE FROM WO A, SECURITY_HEADER B WHERE A.AC LIKE 'PK%' AND A.CREATED_BY=B.\"USER\" AND B.ADOPT_USER_PROFILE LIKE 'MAINT%' AND A.STATUS!='CLOSED' AND A.SCHEDULE_COMPLETION_DATE BETWEEN '$tgl_awal' AND '$tgl_akhir' AND (A.SCHEDULE_COMPLETION_DATE-SYSDATE)<0 ";
$sql_statement = OCIParse($connect,$sql);
OCIExecute($sql_statement);
This is table code
<thead>
<tr bgcolor="#CCCCCC">
<th class="text-center">AC</th>
<th class="text-center">CREATED BY</th>
<th class="text-center">USER PROFILE</th>
<th class="text-center">SCHEDULE COMPLETION DATE</th>
</tr>
</thead>
<?php
while ($row = oci_fetch_array($sql_statement,OCI_BOTH)){
//$no++;
?>
<tbody>
<tr>
<th class="text-center"><font size="2"><?php echo $row['AC']; ?></font></th>
<th class="text-center"><font size="2"><?php echo $row['CREATED_BY']; ?></font></th>
<th class="text-center"><font size="2"><?php echo $row['ADOPT_USER_PROFILE']; ?></font></th>
<th><font size="2"><?php echo $row['SCHEDULE_COMPLETION_DATE']; ?></font></th>
</tr>
</tbody>
<?php
}
oci_free_statement($sql_statement);
oci_close($connect);
?>
</table>
This is a notice :
oci_fetch_array() [function.oci-fetch-array]: ORA-01002: fetch out of sequence in C:\xampp\htdocs\graph\pages\work_orderf3.php on line 544
Line 544
while ($row = oci_fetch_array($sql_statement,OCI_BOTH)){
I'm working with displaying an output when I count the value of the second query is greater than or equal to 2 , using the first query where second query schedule number is equal to the first query schedule number.
The line that I got an error:
if ($x>=2) {.'<button onclick="CreateRevision('.$row['id'].')" type="button" class="btn btn-primary"><span class="fa fa-copy"></span></button>'.} else{}.'.
I just got this message syntax error, unexpected'.'
My whole code is this:
<?php
//open connection to mysql db
include("db_connection.php");
$data = '
<table id="tb_jobsched" class="display nowrap table table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th width="3%">#</th>
<th width="10%">Schedule Number</th>
<th width="20%">Item Name</th>
<th width="10%">Output</th>
<th width="10%">Date Created</th>
<th width="10%">Expected Date</th>
<th width="10%">Prepared By</th>
<th width="7%">Status</th>
<th width="7%"></th>
</tr>
</thead>
<tfoot>
<tr>
<th width="3%">#</th>
<th width="10%">Schedule Number</th>
<th width="20%">Item Name</th>
<th width="10%">Output</th>
<th width="10%">Date Created</th>
<th width="10%">Expected Date</th>
<th width="10%">Prepared By</th>
<th width="7%">Status</th>
<th width="7%"></th>
</tr>
</tfoot>';
$query = "SELECT * FROM prepressjobs WHERE pj_deleted = 0 ORDER BY pj_datecreated DESC";
if (!$result = mysqli_query($db,$query)) {
exit(mysqli_error());
}
// if query results contains rows then featch those rows
if(mysqli_num_rows($result) > 0)
{
$number = 1;
while($row = mysqli_fetch_assoc($result))
{
$data .= '<tr>
<td>'.$number.'</td>
<td>'.$row['pj_schednum'].'</td>
<td>'.$row['pj_itemname'].'</td>
<td>'.$row['pj_output'].'</td>
<td>'.$row['pj_datecreated'].'</td>
<td>'.$row['pj_expectedfinished'].'</td>
<td>'.$row['pj_preparedby'].'</td>
<td>'.$row['pj_status'].'</td>
<td>
<div class="btn-group" role="group" aria-label="Button group with nested dropdown">
<button onclick="GetJobDetails('.$row['id'].')" type="button" class="btn btn-primary"><span class="fa fa-gear"></span></button>
'.
$querya = "SELECT COUNT(rm_schednum) AS jobrevision FROM jobrevisions WHERE rm_schednum ='{$row['pj_schednum']}'";
$resulta= mysqli_query($db, $querya);
$rowa = mysqli_fetch_assoc($resulta);
$x=$rowa['jobrevision'];
if ($x>=2) {.'<button onclick="CreateRevision('.$row['id'].')" type="button" class="btn btn-primary"><span class="fa fa-copy"></span></button>'.} else{}.'
</div>
</td>
</tr>';
$number++;
}
}
else
{
// records now found
$data .= '<tr><td colspan="8">Records not found!</td></tr>';
}
$data .= '</table>';
echo $data;
?>
What is the following solution about this?
<?php
<?php
//open connection to mysql db
include("db_connection.php");
$data = '
<table id="tb_jobsched" class="display nowrap table table-bordered" width="100%" cellspacing="0">
<thead>
<tr>
<th width="3%">#</th>
<th width="10%">Schedule Number</th>
<th width="20%">Item Name</th>
<th width="10%">Output</th>
<th width="10%">Date Created</th>
<th width="10%">Expected Date</th>
<th width="10%">Prepared By</th>
<th width="7%">Status</th>
<th width="7%"></th>
</tr>
</thead>
<tfoot>
<tr>
<th width="3%">#</th>
<th width="10%">Schedule Number</th>
<th width="20%">Item Name</th>
<th width="10%">Output</th>
<th width="10%">Date Created</th>
<th width="10%">Expected Date</th>
<th width="10%">Prepared By</th>
<th width="7%">Status</th>
<th width="7%"></th>
</tr>
</tfoot>';
$query = "SELECT * FROM prepressjobs WHERE pj_deleted = 0 ORDER BY pj_datecreated DESC";
if (!$result = mysqli_query($db,$query)) {
exit(mysqli_error());
}
// if query results contains rows then featch those rows
if(mysqli_num_rows($result) > 0)
{
$number = 1;
while($row = mysqli_fetch_assoc($result))
{
$data .= "<tr>
<td>{$number}</td>
<td>{$row['pj_schednum']}</td>
<td>{$row['pj_itemname']}</td>
<td>{$row['pj_output']}</td>
<td>{$row['pj_datecreated']}</td>
<td>{$row['pj_expectedfinished']}</td>
<td>{$row['pj_preparedby']}</td>
<td>{$row['pj_status']}</td>
<td>
<div class='btn-group' role='group' aria-label='Button group with nested dropdown'>
<button onclick='GetJobDetails({$row['id']})' type='button' class='btn btn-primary'><span class='fa fa-gear'></span></button>
";
$querya = "SELECT COUNT(rm_schednum) AS jobrevision FROM jobrevisions WHERE rm_schednum ='{$row['pj_schednum']}'";
$resulta= mysqli_query($db, $querya);
$rowa = mysqli_fetch_assoc($resulta);
$x = $rowa['jobrevision'];
if ($x>=2) {
$data .= "<button onclick='CreateRevision({$row['id']})' type='button' class='btn btn-primary'><span class='fa fa-copy'></span></button>";
} else{}
$data .= "</div>
</td>
</tr>";
$number++;
}
}
else
{
// records now found
$data .= "<tr><td colspan='8'>Records not found!</td></tr>";
}
$data .= "</table>";
echo $data;
?>
I created a table and used collapsed visibility to try to hide many columns from being shown. The columns still show, just they show up blank. I want it to show as though those columns don't exist. The reason the are there is there is a search box that searches through the table data. I want it to search those items but not display them.
<table id='example1' class='table table-bordered table-striped'>
<thead>
<tr>
<th>Ticket #</th>
<th>Date</th>
<th>Subject</th>
<th>Status</th>
<th>Close Date</th>
<th>Assigned To</th>
<th>Work Order</th>
<th style='visibility:collapse;'>TID #</th>
<th style='visibility:collapse;'>Modem #</th>
<th style='visibility:collapse;'>MHL #</th>
<th style='visibility:collapse;'>Waybill #</th>
<th style='visibility:collapse;'>TID #</th>
<th style='visibility:collapse;'>ATM Brand</th>
<th style='visibility:collapse;'>ATM Model</th>
<th style='visibility:collapse;'>EPP Serial</th>
<th style='visibility:collapse;'>Router #</th>
</tr>
</thead>
<tbody>"; // output data of each row
while($row = $result->fetch_assoc()) { $href='"#"'; echo "
<tr>
<td><a href='tickets.php?id=".$row[' id ']."'>".$row['id']."</a>
</td>
<td>".$row['timecreated']."</td>
<td>".$row['subject']."</td>
<td>".$row['status']."</td>
<td>".$row['closedate']."</td>
<td>".$row['assignedtoname']."</td>
<td>".$row['workorder']."</td>
<td style='visibility:collapse;'></td>
<td style='visibility:collapse;'></td>
<td style='visibility:collapse;'></td>
<td style='visibility:collapse;'></td>
<td style='visibility:collapse;'></td>
<td style='visibility:collapse;'></td>
<td style='visibility:collapse;'></td>
<td style='visibility:collapse;'></td>
<td style='visibility:collapse;'></td>
</tr>"; } } else { echo "0 results"; } echo "</tbody>
<tfoot>
<tr>
<th>Ticket #</th>
<th>Date</th>
<th>Subject</th>
<th>Status</th>
<th>Close Date</th>
<th>Assigned To</th>
<th>Work Order</th>
<th style='visibility:collapse;'>TID #</th>
<th style='visibility:collapse;'>Modem #</th>
<th style='visibility:collapse;'>MHL #</th>
<th style='visibility:collapse;'>Waybill #</th>
<th style='visibility:collapse;'>TID #</th>
<th style='visibility:collapse;'>ATM Brand</th>
<th style='visibility:collapse;'>ATM Model</th>
<th style='visibility:collapse;'>EPP Serial</th>
<th style='visibility:collapse;'>Router #</th>
</tr>
</tfoot>
</table>
Change "visibility:collapse;" to "display: none;"
As per https://developer.mozilla.org/en-US/docs/Web/CSS/visibility, it seems as if you'll have to use display none, instead.
collapse For table rows, columns, column groups, and row groups the
row(s) or column(s) are hidden and the space they would have occupied
is removed (as if display: none were applied to the column/row of the
table). However, the size of other rows and columns is still
calculated as though the cells in the collapsed row(s) or column(s)
are present. This was designed for fast removal of a row/column from a
table without having to recalculate widths and heights for every
portion of the table. For XUL elements, the computed size of the
element is always zero, regardless of other styles that would normally
affect the size, although margins still take effect. For other
elements, collapse is treated the same as hidden.
I have the following code:
<table id="box-table-a" class="tablesorter">
<thead>
<tr>
<th scope="col">B-House/Dorm Name</th>
<th scope="col">Address</th>
<th scope="col">Price Range</th>
<th scope="col">Date Added</th>
<th scope="col">Status</th>
</tr>
</thead>
<?php
$q=mysql_query("select * from property");
while( $f=mysql_fetch_array($q, MYSQL_ASSOC))
{ $p_id=$f["p_id"];
echo"
<tbody>
<tr>
<td onblurr='hover2()' onmouseover='hover(".$p_id.")' onclick='showUser(".$p_id.")'>
<span style='cursor:pointer'>".$f['p_name']."</span></td>
<td id='pretty'>".$f['address']."</td>
<td>".$f['p_name']."</td> <td>".$f['payment_type']."</td> <td>".$status."</td> </tr>
</tbody>
";
}
?>
</table>
Any idea what may be wrong here?
Don't add <tbody></tbody> to every loop in the while! Tablesorter is very sensitive.
You did'nt sort your DB :
$q=mysql_query("select * from property ORDER BY p_name");