Jump to content


Photo

Printing ALL Records


  • Please log in to reply
1 reply to this topic

#1 nixalot

nixalot
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 22 May 2006 - 08:53 PM

Hey guys/gals,
I'm a systems administrator for the State of Mississippi, and I've been put in charge of developing an online database system for use by the supervisors of 5 service center locations. The system I'm putting together is populated via data from another database that is entered directly from call center employees we have here in downtown Jackson. The reason we have two databases is because we don't want to give the service center supervisors/employees direct access to the call center data. I have successfully set up Apache, PHP5, and MySQL on a spare computer we have here at the office and using Dreamweaver 8 I have set up a site and numerous PHP pages to display rosters of all the appointments made by date.

First, let me just say that I have come a LONG way from not knowing ANYTHING whatsoever about PHP to where I am now, however, the pages I have set up display 75 records at a time, and I need to add a "Print Roster" button to the pages so that no matter how many records there are, the supervisors don't have to manually skip to each page and print with their browser print button.

What I would theoretically like to do is to have the "Print Roster" button automatically send the print to the printer in landscape format, fit all fields to the page, and print ALL records from the particular recordset that populates each given page.

I know this is doable... I just don't know how. I have a script for retrieving data and displaying the results... is it as simple as using a print() statement?

This is a huge challenge for me to say the least, however, I have begun to catch somewhat of a fever for PHP since I started working with it... I have been amazed at the things you can do with it even thus far...

Thanks!
nixalot [img src=\"style_emoticons/[#EMO_DIR#]/unsure.gif\" style=\"vertical-align:middle\" emoid=\":unsure:\" border=\"0\" alt=\"unsure.gif\" /]

#2 .josh

.josh
  • Staff Alumni
  • .josh
  • 14,871 posts

Posted 22 May 2006 - 09:17 PM

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
What I would theoretically like to do is to have the "Print Roster" button automatically send the print to the printer in landscape format, fit all fields to the page, and print ALL records from the particular recordset that populates each given page.
[/quote]

well your question is more of a css question, seeing as how the php part is just a standard select everything query and dump it all on the screen, no pagination, etc......

printstuff.php
<html>
<head>
   <style type="text/css" media="print"> 
         div.page { height: 750px;
                         width: 800px;
                         filter: progid:D/XImageTransform.Microsoft.BasicImage(Rotation=1); }
   </style>
</head>
<body>
<div class="page">

<?php 
   //need to establish connection to database before the following code...
   $sql = "select * from table";
   $result = mysql_query($sql) or die(mysql_error();
   while ($info = mysql_fetch_array($result)) {
       //dunno what columns you have or types or anything. echo your info here...
       echo $info['blah'] . "<br>";
   }
?>

</div>
</html>
</body>

i can't really help you on fitting all the fields to the page, as i have no idea what kind of fields or how many there are... but, notice how there is no pagination scripting in there, so it will just dump everything onto the screen.

p.s. - this only works with IE
Did I help you? Feeling generous? Buy me lunch! 
Please, take the time and do some research and find out how much it would have cost you to get your help from a decent paid-for source. A "roll-of-the-dice" freelancer will charge you $5-$15/hr. A decent entry level freelancer will charge you around $15-30/hr. A professional will charge you anywhere from $50-$100/hr. An agency will charge anywhere from $100-$250/hr. Think about all this when soliciting for help here. Think about how much money you are making from the work you are asking for help on. No, we do not expect you to pay for the help given here, but donating a few bucks is a fraction of the cost of what you would have paid, shows your appreciation, helps motivate people to keep offering help without the pricetag, and helps make this a higher quality free-help community :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users