Menu

Printer Friendly is Blank...

Help
chizzle
2005-01-31
2013-06-03
  • chizzle

    chizzle - 2005-01-31

    I dont know when this started but I just noticed it, when I click on the printer friendly link in the admin portal all I see is the categories from the form but no data that was submitted is displayed.  Any Ideas??

    Thanks all great program, I have been using it for over a year now..

     
    • chizzle

      chizzle - 2005-01-31

      Oh the cpanel server are just wonderful...  The existing forms I have all post data to the database and can be viewed in the admin portal.  I just created a new form and it the Printer Friendly is working on this form only.  My existing forms will not show any data after clicking on Printer Friendly, just the categories.  Well enough of the recap.. 
      I had a restore done to my server about 3 weeks ago and something must have went bad there.  I restored all of my data through cpanel and something got hosed during the trasfer of files and db's.
      Anyone have any thoughts on this??

      Thanks all

       
    • skipper36

      skipper36 - 2005-02-10

      I believe it has to do with the ID= parameter.  If you delete some early records, and the ID= parameter is greater than the number of existing records, I believe that is when it comes back blank.

       
      • Linda

        Linda - 2005-08-12

        Has anyone found the fix for this problem?

        Skipper36 is correct: "If you delete some early records, and the ID= parameter is greater than the number of existing records, I believe that is when it comes back blank."

        I currently have 3 records in my database and I have deleted quite a few test records. The current records are:
        id=12
        id=17
        id=18

        When I ask to print id=12 I get blanks, but I can print properly if I change the id in the URL to 01

        When I ask to print id=17 I get blanks, but I can print properly if I change the id in the URL to 02

        When I ask to print id=18I get blanks, but I can print properly if I change the id in the URL to 03

         
    • Will Stein

      Will Stein - 2005-04-22

      Any way to fix / prevent?

       
    • Will Stein

      Will Stein - 2005-04-22

      Any way to fix / prevent?
      Update: When clicking "print" it displays the record after the current.

       
    • TNTEverett

      TNTEverett - 2005-08-12

      What kind of database are you using.  If I can duplicate your scenario I will spend some time looking into the issue. 

       
      • Linda

        Linda - 2005-08-12

        I'm using a MySql database. If I can help in any other way, just let me know.

        Thanks!

         
    • TNTEverett

      TNTEverett - 2005-08-13

      OK, I have a solution to your problem.  It involves changing your printer_friendly.php file for any form you have this problem with.  Since I am not the author of the program I can not integrate this into the original source code. 

      Here we go:
      1.) Open the printer_friendly.php file. 
      2.) Find line 9.
      3.) Change "$id++;" to "$id;"
      4.) Find line 59.  "for ($i=0; $i < count($columns); $i++) {"
      5.) Comment out (double forward slash at the begining) lines 59 through 62. 
      6.) Add this in its place:

      foreach ($results as $key => $value) {
        if ($value[0] == $id) {
          for ($i=0; $i < count($columns); $i++) {
            $html_output .= "<tr><td align=\"left\" valign=\"middle\">" . $columns[$i] . ":</td>\n";
            $html_output .= "<td align=\"left\" valign=\"middle\">" . $results[($key)][$columns[$i]] . "</td></tr>\n";
          }
        }
      }

      7.) Don't touch anything else.
      8.) Let me know how it works for you.  Test all entries.  If you have time, create another database with multiple gaps in the sequence of id numbers and test it again. 

      Let me explain why this works.
      Example 21 entry SQL database after deleting entries 3-18:
      0  1     Value1a   Value1b
      1  2     Value2a   Value2b
      2 19    Value19a Value19b
      3 20    Value20a Value20b
      4 21    Value21a Value21b

      Columns are:
      [database entry] [id] [value a] [value b]

      Problem: The id is passed as the database entry lookup.  The admin id numbers always start with 1 and keep their value per entry even after some entries are deleted.  If you pass id 1 you will never see value1[a,b].  Passing any other id only works if the id is within the range of database entries 1 to total entries-1.  You can see that id numbers 19 and 20 will never work as they are now greater than the total number of entries-1, or 4 in this case.

      Solution:  The database is first scanned until the id passed is equal to one of the id numbers in the database.  The new variable $key is now the database entry lookup.  The $key is incremented from 0 to total entries-1 and only the entry with the matching id is captured for display. 

       
    • TNTEverett

      TNTEverett - 2005-08-16

      Any luck?

       
    • Linda

      Linda - 2005-08-19

      Sorry... I've been away on vacation. I'll try this out in the next day or two and let you know. Thank you!

       
    • Linda

      Linda - 2005-08-21

      I made the changes and everything seems to be working just fine. Thank you!

      I didn't go as far as setting up another database to test, I did make several additions and deletions to the current database and it seemed to work fine.

      Thanks again!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.