ballhogjoni Posted January 26, 2007 Share Posted January 26, 2007 Hi everyone!I am trying to figure out how to print my database fields to an actual printer.Basically my mysql database is chalk full of leads that I have collected, and now I want to be able to print these records or leads on a piece of paper in a certain format. I think I can figure out the formatting but I dont know the php code to do this.Can anyone send me some code or post a link that would teach me how to do this?thx in advance ;) Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 26, 2007 Share Posted January 26, 2007 AFAIK, you'd have to generate what you want printed, and actually print it yourself. Such as generate a PDF, then make your computer print it. PHP isn't mean to handle interactions between computers and peripherals, it's a server-side language. Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted January 26, 2007 Author Share Posted January 26, 2007 so are you saying I would have to print all 10,000 leads one by one? Is there a way to use javascript or some other language? Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 26, 2007 Share Posted January 26, 2007 What?Select them all out of the database, display them all on the screen like you normally would and print it.By print, you mean onto paper via a printer, with ink, yes? What I was saying is PHP can't interact with that device. If you're asking how to get it out of the database, how'd you get it in there in the first place? There are tutorials on databases in the beginners section on this site. Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted January 26, 2007 Author Share Posted January 26, 2007 no no, I can select the fields from my tables into a browser, but thats not what I really want to do.I want to be able to print each record on a seperate sheet of paper because I have a call center where my sales people sell our product to our leads.yes its to an actual printer with ink. :D Quote Link to comment Share on other sites More sharing options...
pikemsu28 Posted January 26, 2007 Share Posted January 26, 2007 you could possibly output your fields to a browser placing a page break after each record when printed using CSS.<just a thought> Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 26, 2007 Share Posted January 26, 2007 I would use PHP to generate a PDF file, and print that, that way they can all be on seperate sheets of paper. Quote Link to comment Share on other sites More sharing options...
ballhogjoni Posted January 26, 2007 Author Share Posted January 26, 2007 [quote]you could possibly output your fields to a browser placing a page break after each record when printed using CSS.[/quote]How would I do that?[quote]I would use PHP to generate a PDF file, and print that, that way they can all be on seperate sheets of paper.[/quote]and how would I do that? any code or link would help. Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 26, 2007 Share Posted January 26, 2007 http://www.google.com/search?q=Generate+PDF+with+PHPFirst and second results look good.Or search the manual for PDF. Quote Link to comment Share on other sites More sharing options...
pikemsu28 Posted January 29, 2007 Share Posted January 29, 2007 if your using a dynamic table to generate each record just assign a css class to it:[code]<style type="text/css" media="print">//goes under <title></title>.break { page-break-after: always;}</style><td class="break"><tr>record</tr></td>[/code]something like that should do the trick.something like that Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.