SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Zealot Makavely's Avatar
    Join Date
    Jul 2004
    Location
    Romania
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php print pages from db

    Hello!

    Does anyone knows how to print multiple pages from DB? Something like js window.print() but print pages dynamically?

    Thx

  2. #2
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Plano
    Posts
    643
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    use PHP to display the results how you want them, then use that javascript function to print them out. if that doesn't answer your question, i don't know what you're asking.

  3. #3
    SitePoint Zealot Makavely's Avatar
    Join Date
    Jul 2004
    Location
    Romania
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i want to push a button from the admin area of a project and print 100 invoices from mysql DB using php.

  4. #4
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Plano
    Posts
    643
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok...you're going to need to design it in PHP and HTML...then once you've done that, you can just hit print, and it will print out everything you need. If you don't know PHP, maybe talk to someone that does and can set this up for you.

  5. #5
    SitePoint Zealot Makavely's Avatar
    Join Date
    Jul 2004
    Location
    Romania
    Posts
    135
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i know php..it is not this problem..

    So here it is : I have a database with 100 clients. I can print invoices when they come to pay some services by displaying the invoice template and just push the print button.Ok i've done that, it's very simple. BUT i need that at the end of the each month to push a BUTTON that prints ALL invoices FROM the database...

    is that possible???does anyone had my problem?

  6. #6
    SitePoint Wizard wheeler's Avatar
    Join Date
    Mar 2006
    Location
    Gold Coast, Australia
    Posts
    1,369
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes, you can construct the whole month within one script quite easily.

    What you are really looking for, is a sql query, followed by a php loop like:
    PHP Code:
    $query mysql_query("SELECT * FROM records WHERE month = '04'");

    while (
    $data mysql_fetch_array($query))
    {
      
    $id $data['id'];
      
    $name $data['name'];

      echo 
    "$id $name <br />";

    Studiotime - Time Management for Web Developers
    to-do's, messages, invoicing, reporting - 30 day free trial!
    Thomas Multimedia Web Development

  7. #7
    SitePoint Evangelist cronsrcs's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    500
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just to add something that may well give you further ideas - you can use some CSS to ensure that there is a page break after (or before) a certain element in your html.
    Then when you print the page showing all of the invoices they will come out on a new page despite the fact that they appear as one tall/long page in your browser.

    I dont know the CSS off the top of my head, but will google it and post back.

    Cheers
    www.silver-rocket.com
    Creative Solutions for this planet and beyond...
    www.onelifeonebus.com
    Fear fading away, not burning out.

  8. #8
    SitePoint Evangelist cronsrcs's Avatar
    Join Date
    Oct 2004
    Location
    UK
    Posts
    500
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    here you go this should start you off
    www.silver-rocket.com
    Creative Solutions for this planet and beyond...
    www.onelifeonebus.com
    Fear fading away, not burning out.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •