473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

printable version on web page

64
Hi,

Anyone can help me on how to create a printable version of MySQL data to be printed from PDF of Excel but moat preferably on the webpage?

[PHP]<? require_once '../../functions.php'; $sql = "SELECT * FROM fragrancestock WHERE Quantity = '0'"; $rowsPerPage = 10; $result = dbQuery(getPagingQuery($sql, $rowsPerPage)); $pagingLink = getPagingLink($sql, $rowsPerPage); ?> <form action="index.php?view=add" method="post" name="frmList" id="frmList"> <table width="700" border="0" align="center"> <tr class="title_text"> <td colspan="7"></td> </tr> <tr class="title_text"> <td width="200">Category</td> <td width="200">Brand</td> <td width="200">Available Stock</td> <td width="200">Date Added</td> <td width="50">Details</td> <td width="50">Add</td> <td width="50">Delete</td> </tr> <?php if (dbNumRows($result) > 0) { $i = 0; while($row = dbFetchAssoc($result)) { extract($row); if ($i%2) { $class = 'row1'; } else { $class = 'row2'; } $i += 1; ?> <tr class="<?php echo $class; ?>"> <td width="200"><?php echo $Category; ?></td> <td width="200"><?php echo $Brand; ?></td> <td width="200" class="inner_border"><?php echo $Quantity; ?></td> <td width="200"><?php echo $DateAddedStock; ?></td> <td width="50"><a href="<?php echo $_SERVER['PHP_SELF']; ?>?view=detail&StockID=<?php echo $StockID; ?>">View</a></td> <td width="50"><a href="javascript:modifyStock(<?php echo $StockID; ?>);"><strong>Add </strong> </a></td> <td width="50"><a href="javascript:deleteStock(<?php echo $StockID; ?>);">Delete</a></td> </tr> <?php } // end while ?> <tr> <td colspan="7" align="center"> <?php echo $pagingLink; ?> </td> </tr> <?php } else { ?> <tr> <td colspan="7" align="center">No stock for <? echo '<strong>'; echo $ShowBrand; echo '&nbsp;'; echo "</strong>"; ?></td> </tr> <?php } ?> <tr> <td colspan="7">&nbsp;</td> </tr> <tr> <td colspan="6" align="right"> <input name="btnAddStock" type="submit" value="New Entry" class="button_image"> <td align="right"><input name="btnCancel" type="button" id="btnCancel" value="Return" onClick="window.history.back();" class="button_image"></tr> </table> <p>&nbsp;</p> </form>[/PHP]
Sep 11 '08 #1
2 3031
nathj
938 Expert 512MB
Hi,

If you are outputting MySQL data on your webpage I'm gonna recommend you have a couple of CSS files - one to define the screen layout and one to define the print layout.

That way it looks great on screen and then looks great printed with no need to a 'printer friendly version' link

Just Goole 'print CSS'

You may run into issues using tables to control your layout. Perhaps consider switching to a CSS layout and using tables simply fro tabular data (sorry if I've misunderstood your code)

Cheers
nathj
Sep 12 '08 #2
Ajm113
161 100+
Well about printed out to a pdf, you mite want to look into Headers.

BTW work on your formatting, bots and you are going to have issues looking at the code when they open them up and including other users looking at it, will discourage them helping you.

Header()

Use the first header function on the example
PHP.net

Example #1 Download dialog

If you want the user to be prompted to save the data you are sending, such as a generated PDF file, you can use the » Content-Disposition header to supply a recommended filename and force the browser to display the save dialog.
[PHP]<?php
// We'll be outputting a PDF
header('Content-type: application/pdf');

// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');

// The PDF source is in original.pdf
readfile('original.pdf');
?>[/PHP]
Sep 12 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Daniel Alexandre | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi there, I'm using the following method in my program to check whether a message received is printable or not and to strip the non-printable...
17
by: CJM | last post by:
....When I say 'form' I'm talking about a conventional paper version, as opposed to a <form>. I'm building a web-based application which needs to be able to create Invoices/Advice Notes/Order...
2
by: Harold R | last post by:
Is there HTML code available to provide a printable version of a web page? Without the browser graphics, that is. -- Regards, Harold A Ralston Racine, Wisconsin, USA
10
by: CJM | last post by:
....When I say 'form' I'm talking about a conventional paper version, as opposed to a <form>. I'm building a web-based application which needs to be able to create Invoices/Advice Notes/Order...
5
by: moondaddy | last post by:
I'm going to use an aspx page to display an invoice that customers can print from. Sometimes when I go to a site and navigate to a page I want to print, they will have a button that says something...
1
by: Steve Podradchik | last post by:
Hi, Our app likes to print data-rich output that fills the page width of the printer. Unfortunately, we've found that the printable area of each printer is a little different, making it a bit...
5
by: Peter Chant | last post by:
Any thoughts in the newsgroup? Over Christmas I produced, using PHP and MySQL, a database and front end to record my familys family tree with a short biography and linked photos and locations if...
3
by: Arancaytar | last post by:
This is my site: http://arancaytar.ermarian.net/ I am using this stylesheet to generate a printable version of the page (using media="print"): ...
4
by: John K Masters | last post by:
>From what I have read the string module is obsolete and should not be used but I am working on a project that parses printable files created in a DOS program and creates a web page for each file....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.