Solved

printing in php!!!!!

Posted on 2002-06-20
11
211 Views
Last Modified: 2006-11-17
hai all,

I have a php(+html codes) thru which I try to display my queries.
In that if I add print button(which links to javascript window.print function),Iam able to print the table with no format.If I wanted to print only 30 rows in one page & remaining in successive pages(/page= 30 rows),how am I implement this feature.can anyone help resolve this issue.

Thanking you,
manju
0
Comment
Question by:manju70
11 Comments
 
LVL 4

Expert Comment

by:lokeshv
ID: 7097809
Display 30 rows per page..and print it :o)

Lk
0
 

Author Comment

by:manju70
ID: 7098250
yes
0
 
LVL 8

Accepted Solution

by:
us111 earned 18 total points
ID: 7098317
- create a button
- add a javascript action that calls and opens a new php page
- this page display 30 rows
- open the print windows

I have no other solutions
0
 
LVL 17

Expert Comment

by:psimation
ID: 7098593
manju70
us111 is correct, maybe to help to make it more clear, use your existing code , and then simply limit your output to 30 lines . This can be done by adding a "...limit 30" to the end of your SQL query, or to have a while loop that only creates 30 lines at a time, and then have a "next" link on the page to execute and display the rest of the lines , 30 ata a time.
 
0
 
LVL 8

Expert Comment

by:us111
ID: 7098598
but if your page has more than 30 records, it would be impossible to print 2 friendly pages
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 5

Expert Comment

by:Hamlet081299
ID: 7105856
I think there is actually an HTML code which will force a page break in printing (I forget what it is though), but there may be better ways of doing this.

You could try rendering the output as a PDF, and then printing.

You could also have the print button link to another page, which automatically loads 30 records at a time and prints each one, then automatically jumps to the next 30, etc.
0
 
LVL 40

Expert Comment

by:RQuadling
ID: 7106815
There are CSS Style print codes. These are NOT HTML codes.

The full definition is at ...

http://www.w3.org/TR/1998/REC-CSS2-19980512/page.html

but your broweser (or rather your customer's browser) will need to support this!!!

Without doubt, the best way is to send the client a pre-rendered document (rtf/pdf/DOC via COM!!!/etc).

Having a seperate window with the table size being set by the end-user is a good idea. Simpler to implement than PDF (maybe), but no automation as the print command returns true immediately, even if the printing is still working. So you can't generate 10 pages, calling the print event between each generation as you will probably get 9 headers and then 1 full page. It'll be a mess!

Richard.
0
 

Author Comment

by:manju70
ID: 7109751
hai all,

Thank you for your responses.
I got my requirements as per us111 & psimation comments.
So I wanted to distribute my points among these 2 experts.I have asked the commnunity support to distribute it accordingly.

a big thanks for all who contributed.
Manju

0
 
LVL 8

Expert Comment

by:us111
ID: 7109915
thx
0
 
LVL 5

Expert Comment

by:Netminder
ID: 7114290
Per request (http://www.experts-exchange.com/commspt/Q_20316277.html), points reduced to 18 to facilitate split.

manju70,

You should now leave a 17-point question in this topic area for one of the two Experts. Then come back to this question and accept the comment of the other, and leave a link here to the "points for" question.

In the "points for" question, be sure to leave a link back to this question to complete the circle.

Netminder
CS Moderator
0
 

Author Comment

by:manju70
ID: 7115459
hai psimation,

As I wanted to distribute my marks between u & us111 , I have created another question(as per community support instructions)
the link is
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=php&qid=20317170

after u answer, the points will evventually deposited in ur account.

Thank u,
manju
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now