Jump to content

Recommended Posts

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\" /]
Link to comment
https://forums.phpfreaks.com/topic/10215-printing-all-records/
Share on other sites

[!--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
[code]
<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>
[/code]

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
Link to comment
https://forums.phpfreaks.com/topic/10215-printing-all-records/#findComment-38066
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.